diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index a489da7d0..bae5a657b 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -15,7 +15,7 @@ jobs: steps: - name: "Prune stale issues and pull requests" - uses: "actions/stale@v10.1.1" + uses: "actions/stale@v10.2.0" with: repo-token: "${{ secrets.GITHUB_TOKEN }}" days-before-close: "${{ env.DAYS_BEFORE_CLOSE }}" diff --git a/.gitignore b/.gitignore index 10ea067ab..3244eed84 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .php-cs-fixer.cache .php_cs.cache .phpactor.json +.phpunit.cache .phpunit.result.cache bin/_* composer.lock diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..2fdf270d9 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,76 @@ +# Yasumi — Agent Instructions + +Yasumi is a PHP library for calculating public holidays across countries and regions. +It is calculation-driven (no database), provider-based (one class per country/region), +and PSR-12/PSR-4 compliant. + +## Project Structure + +``` +src/Yasumi/ + Yasumi.php # Main entry point / factory + Holiday.php # Represents a single holiday + SubstituteHoliday.php # Substituted holiday + ProviderInterface.php # Contract all providers must implement + Translations.php # Holiday name translations + Provider/ # One file (or directory) per country/region + AbstractProvider.php # Base class for all providers + CommonHolidays.php # Reusable holiday calculations (New Year's, etc.) + ChristianHolidays.php # Easter and related calculations + *.php / */ # Country and sub-region providers + Filters/ # Holiday type filters (Official, Bank, etc.) + data/ # Translation data files +tests/ # PHPUnit tests, mirroring src structure +examples/ # Usage examples +``` + +## Requirements + +- PHP 8.2+ +- `ext-json` (required), `ext-intl` (dev), `ext-calendar` (optional, for Easter) + +## Key Commands + +```shell +composer test # Run the full PHPUnit test suite +composer cs # Check coding standard (dry-run) +composer cs-fix # Auto-fix coding standard violations (alias: composer format) +composer phpstan # Run static analysis (level 8) +``` + +## Coding Conventions + +- **PSR-12** coding standard enforced via `php-cs-fixer`. Always run `composer cs-fix` after changes. +- **PSR-4** autoloading: `Yasumi\` → `src/Yasumi/`, `Yasumi\tests\` → `tests/`. +- Strict types (`declare(strict_types=1)`) are required in all PHP files. +- Holiday providers extend `AbstractProvider` and implement `initialize()`. + +## Adding a New Holiday Provider + +1. Create `src/Yasumi/Provider/{CountryName}.php` extending `AbstractProvider`. +2. Implement `initialize()`: call `addHoliday()` for each holiday. +3. Implement `getSources()`: list of external resources. +4. Add translations to `src/Yasumi/data/`. +5. Create `tests/{CountryName}/{CountryName}BaseTestCase.php` (shared assertions). +6. Create `tests/{CountryName}/{CountryName}Test.php` (country-level tests asserting all expected holidays). +7. Add a `` entry in `phpunit.xml.dist`. +8. Each test must cover multiple years; respect establishment/abolition years of holidays. + +## Testing + +- All new providers and holidays **must** have unit tests — PRs without tests are not accepted. +- Tests use PHPUnit 11 and iterate over a range of years automatically. +- Run a specific suite: `vendor/bin/phpunit --testsuite Netherlands` + +## Static Analysis + +- PHPStan at level 8. Run `composer phpstan` and fix all errors before committing. +- Ignored errors are listed in `phpstan.neon.dist`; do not add new ignores without good reason. + +## Pull Request Guidelines + +- One PR per feature or country provider. +- Run `composer test`, `composer cs`, and `composer phpstan` before submitting. +- Adhere to conventional commits for commit conventions. +- Squash intermediate commits; keep history meaningful. +- Branch off `develop`; target `develop` for PRs. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e68e0bd46..c4ed0569c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,15 +10,14 @@ When contributing there are a few guidelines we'd like you to keep in mind: - **[PSR-12 Coding Standard](https://www.php-fig.org/psr/psr-12/)** Please use the following command after you have completed your work: - ```shell - composer format - ``` + ```shell + composer format + ``` - This will check/correct all the code for the PSR-12 Coding Standard using the - wonderful [php-cs-fixer](https://cs.symfony.com). + This will check/correct all the code for the PSR-12 Coding Standard using the + wonderful [php-cs-fixer](https://cs.symfony.com). - **Add unit tests!** - Your Pull Request won't be accepted if it does not have tests: - 1. Ensure your new Holiday Provider contains all the necessary unit tests. 2. Next to the file `{REGIONNAME}BaseTestCase.php`, a file called `{REGIONNAME}Test.php` needs to be present. This file needs to include region/country level tests and requires assertion of all expected holidays. @@ -37,6 +36,18 @@ When contributing there are a few guidelines we'd like you to keep in mind: please [squash them](https://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_changing_multiple) before submitting. +- **Use [Conventional Commits](https://www.conventionalcommits.org)** - Commit messages must follow the Conventional + Commits specification (e.g. `feat(Netherlands): add holiday X`, `fix(Germany): correct date for Y`). + +- **Sign your commits (DCO)** - Each commit must include a `Signed-off-by` trailer to certify you agree to the + [Developer Certificate of Origin](DCO): + + ```shell + git commit -s -m "feat: your change" + ``` + +- **Branch and PR target** - Always branch off `develop` and open your pull request against `develop`. + ## Running Tests ```shell @@ -48,3 +59,19 @@ Or, alternatively run with: ```shell vendor/bin/phpunit ``` + +Run a specific suite by name: + +```shell +vendor/bin/phpunit --testsuite Netherlands +``` + +## Before Submitting + +Always run all three checks before opening a pull request: + +```shell +composer cs # Check coding standard +composer phpstan # Static analysis (level 8) +composer test # Full test suite +``` diff --git a/SECURITY.md b/SECURITY.md index 0e6494d6c..001008f0f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -6,12 +6,11 @@ The following versions are supported with security updates: | Version | Supported | | ------- | ------------------ | -| 2.9.0 | :white_check_mark: | -| 2.8.0 | :white_check_mark: | -| 2.7.0 | :white_check_mark: | -| 2.6.0 | :x: | -| 2.5.0 | :x: | -| <2.4 | :x: | +| 2.10.0 | :white_check_mark: | +| 2.9.0 | :white_check_mark: | +| 2.8.0 | :x: | +| 2.7.0 | :x: | +| <2.7 | :x: | As for supported PHP versions, this project only supports the actively supported versions of PHP and versions of PHP that only receive critical security updates. Currently, that is PHP 8.2, 8.3, 8.4 and 8.5. @@ -22,7 +21,8 @@ support of that retired PHP version. ## Reporting a Vulnerability If you would like to report a vulnerability or have any security concerns with this project, -please [open an issue](https://github.com/azuyalabs/yasumi/issues/new?labels=security). +please use [GitHub's private vulnerability reporting](https://github.com/azuyalabs/yasumi/security/advisories/new) +to disclose it privately before a fix is available. To investigate your request as good as possible, please include any of the following when reporting: diff --git a/composer.json b/composer.json index 7c949aa78..3d4f13d7d 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ "mikey179/vfsstream": "^1.6", "phpstan/phpstan": "^2.1", "phpstan/phpstan-deprecation-rules": "^2.0", - "phpunit/phpunit": "^8.5 || ^9.6" + "phpunit/phpunit": "^11.5" }, "suggest": { "ext-calendar": "For calculating the date of Easter" diff --git a/examples/basic.php b/examples/basic.php index b84246fd9..35a5a1214 100644 --- a/examples/basic.php +++ b/examples/basic.php @@ -43,18 +43,20 @@ // Get a holiday instance for Independence Day $independenceDay = $holidays->getHoliday('independenceDay'); -// Show the localized name -echo 'Name of the holiday : ' . $independenceDay->getName() . PHP_EOL; +if (null !== $independenceDay) { + // Show the localized name + echo 'Name of the holiday : ' . $independenceDay->getName() . PHP_EOL; -// Show the date -echo "Date of the holiday : {$independenceDay}" . PHP_EOL; + // Show the date + echo "Date of the holiday : {$independenceDay}" . PHP_EOL; -// Show the type of holiday -echo 'Type of holiday : ' . $independenceDay->getType() . PHP_EOL; + // Show the type of holiday + echo 'Type of holiday : ' . $independenceDay->getType() . PHP_EOL; +} echo PHP_EOL; // Dump the holiday as a JSON object echo 'Holiday as a JSON object:' . PHP_EOL; -echo json_encode($independenceDay, JSON_PRETTY_PRINT); +echo json_encode($independenceDay ?? [], JSON_PRETTY_PRINT); echo PHP_EOL; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index b14e98e42..3690021d8 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,5 @@ parameters: - level: 6 + level: 8 paths: - src - examples @@ -7,8 +7,6 @@ parameters: - message: '#Comparison operation "<=" between [0-9]+ and int<[0-9]+, max> is always true.#' path: src/Yasumi/Provider/Turkey.php - - - identifier: missingType.generics reportUnmatchedIgnoredErrors: true # Do not allow outdated errors in the baseline treatPhpDocTypesAsCertain: false tipsOfTheDay: false diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 67c288aa2..487caff83 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -9,203 +9,211 @@ ~ ~ @author Sacha Telgenhof --> - - - - - - - - - ./src/Yasumi - - - ./src/Yasumi/data - - - - - - ./tests - - - - ./tests/Base - - - - ./tests/Argentina - - - - ./tests/Australia - - - - ./tests/Austria - - - - ./tests/Belgium - - - - ./tests/Bosnia - - - - ./tests/Brazil - - - - ./tests/Canada - - - - ./tests/Croatia - - - - ./tests/CzechRepublic - - - - ./tests/Denmark - - - - ./tests/Estonia - - - - ./tests/Finland - - - - ./tests/France - - - - ./tests/Georgia - - - - ./tests/Germany - - - - ./tests/Greece - - - - ./tests/Hungary - - - - ./tests/Ireland - - - - ./tests/Italy - - - - ./tests/Japan - - - - ./tests/Latvia - - - - ./tests/Lithuania - - - - ./tests/Luxembourg - - - - ./tests/Netherlands - - - - ./tests/NewZealand - - - - ./tests/Norway - - - - ./tests/Poland - - - - ./tests/Portugal - - - - ./tests/Romania - - - - ./tests/Russia - - - - ./tests/Slovakia - - - - ./tests/Slovenia - - - - ./tests/SouthAfrica - - - - ./tests/SouthKorea - - - - ./tests/Spain - - - - ./tests/Sweden - - - - ./tests/Switzerland - - - - ./tests/Turkey - - - - ./tests/Ukraine - - - - ./tests/UnitedKingdom - - - - ./tests/USA - - - - ./tests/USA/NYSE - - + + + + + + + + ./tests/Base + + + + ./tests/Andorra + + + + ./tests/Argentina + + + + ./tests/Australia + + + + ./tests/Austria + + + + ./tests/Belgium + + + + ./tests/Bosnia + + + + ./tests/Brazil + + + + ./tests/Bulgaria + + + + ./tests/Canada + + + + ./tests/Croatia + + + + ./tests/CzechRepublic + + + + ./tests/Denmark + + + + ./tests/Estonia + + + + ./tests/Finland + + + + ./tests/France + + + + ./tests/Georgia + + + + ./tests/Germany + + + + ./tests/Greece + + + + ./tests/Hungary + + + + ./tests/Iran + + + + ./tests/Ireland + + + + ./tests/Italy + + + + ./tests/Japan + + + + ./tests/Latvia + + + + ./tests/Lithuania + + + + ./tests/Luxembourg + + + + ./tests/Mexico + + + + ./tests/Netherlands + + + + ./tests/NewZealand + + + + ./tests/Norway + + + + ./tests/Poland + + + + ./tests/Portugal + + + + ./tests/Romania + + + + ./tests/Russia + + + + ./tests/SanMarino + + + + ./tests/Slovakia + + + + ./tests/Slovenia + + + + ./tests/SouthAfrica + + + + ./tests/SouthKorea + + + + ./tests/Spain + + + + ./tests/Sweden + + + + ./tests/Switzerland + + + + ./tests/Turkey + + + + ./tests/Ukraine + + + + ./tests/UnitedKingdom + + + + ./tests/USA + ./tests/USA/NYSE + + + + ./tests/USA/NYSE + + + + + ./src/Yasumi + + + ./src/Yasumi/data + + diff --git a/rector.php b/rector.php index 95d45465b..26124c57f 100644 --- a/rector.php +++ b/rector.php @@ -17,6 +17,7 @@ use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; use Rector\Config\RectorConfig; +use Rector\PHPUnit\Set\PHPUnitSetList; use Rector\Set\ValueObject\SetList; return static function (RectorConfig $rectorConfig): void { @@ -35,5 +36,6 @@ SetList::EARLY_RETURN, SetList::PHP_82, SetList::TYPE_DECLARATION, + PHPUnitSetList::PHPUNIT_110, ]); }; diff --git a/src/Yasumi/Filters/AbstractFilter.php b/src/Yasumi/Filters/AbstractFilter.php index faaa21ac0..1ed6493ed 100644 --- a/src/Yasumi/Filters/AbstractFilter.php +++ b/src/Yasumi/Filters/AbstractFilter.php @@ -17,8 +17,10 @@ namespace Yasumi\Filters; +use Yasumi\Holiday; use Yasumi\SubstituteHoliday; +/** @extends \FilterIterator> */ abstract class AbstractFilter extends \FilterIterator implements \Countable { /** diff --git a/src/Yasumi/Filters/BetweenFilter.php b/src/Yasumi/Filters/BetweenFilter.php index f57ea9a4e..880bc3e6f 100644 --- a/src/Yasumi/Filters/BetweenFilter.php +++ b/src/Yasumi/Filters/BetweenFilter.php @@ -17,8 +17,6 @@ namespace Yasumi\Filters; -use Yasumi\ProviderInterface; - /** * BetweenFilter is a class used for filtering holidays based on given date range. * @@ -40,11 +38,11 @@ class BetweenFilter extends AbstractFilter /** * Construct the Between FilterIterator Object. * - * @param \Iterator $iterator Iterator object of the Holidays Provider - * @param \DateTimeInterface $startDate Start date of the time frame to check against - * @param \DateTimeInterface $endDate End date of the time frame to check against - * @param bool $equal Indicate whether the start and end dates should be included in the - * comparison + * @param \Iterator $iterator Iterator object of the Holidays Provider + * @param \DateTimeInterface $startDate Start date of the time frame to check against + * @param \DateTimeInterface $endDate End date of the time frame to check against + * @param bool $equal Indicate whether the start and end dates should be included in the + * comparison */ public function __construct( \Iterator $iterator, diff --git a/src/Yasumi/Filters/OnFilter.php b/src/Yasumi/Filters/OnFilter.php index da655d31f..a1c6d947a 100644 --- a/src/Yasumi/Filters/OnFilter.php +++ b/src/Yasumi/Filters/OnFilter.php @@ -17,8 +17,6 @@ namespace Yasumi\Filters; -use Yasumi\ProviderInterface; - /** * OnFilter is a class used for filtering holidays based on a given date. * @@ -36,8 +34,8 @@ class OnFilter extends AbstractFilter /** * 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 + * @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, diff --git a/src/Yasumi/Provider/AbstractProvider.php b/src/Yasumi/Provider/AbstractProvider.php index 2f00ccdd4..d43c9c67f 100644 --- a/src/Yasumi/Provider/AbstractProvider.php +++ b/src/Yasumi/Provider/AbstractProvider.php @@ -28,6 +28,8 @@ /** * Class AbstractProvider. + * + * @implements \IteratorAggregate */ abstract class AbstractProvider implements \Countable, ProviderInterface, \IteratorAggregate { @@ -112,6 +114,9 @@ public function __construct( $this->initialize(); } + /** Initialize country holidays */ + abstract public function initialize(): void; + public function addHoliday(Holiday $holiday): void { if ($this->globalTranslations instanceof TranslationsInterface) { @@ -124,6 +129,8 @@ public function addHoliday(Holiday $holiday): void public function removeHoliday(string $key): void { + $this->isHolidayKeyNotEmpty($key); + unset($this->holidays[$key]); } @@ -194,6 +201,8 @@ public function getHolidays(): array public function getHolidayNames(): array { + $this->ensureSorted(); + return array_keys($this->holidays); } @@ -209,11 +218,7 @@ public function next(string $key): ?Holiday public function getHoliday(string $key): ?Holiday { - $this->isHolidayKeyNotEmpty($key); // Validate if key is not empty - - $holidays = $this->getHolidays(); - - return $holidays[$key] ?? null; + return $this->holidays[$key] ?? null; } public function previous(string $key): ?Holiday @@ -233,6 +238,7 @@ public function between( return new BetweenFilter($this->getIterator(), $startDate, $endDate, $equals ?? true); } + /** @return \ArrayIterator */ public function getIterator(): \ArrayIterator { $this->ensureSorted(); @@ -252,23 +258,6 @@ public function getHolidayDates(): array return array_map(static fn (Holiday $holiday): string => (string) $holiday, $this->holidays); } - /** - * Checks whether the given holiday is not empty. - * - * @param string $key key of the holiday to be checked - * - * @return true upon success, otherwise an InvalidArgumentException is thrown - * - * @throws \InvalidArgumentException an InvalidArgumentException is thrown if the given holiday parameter is empty - * - * @deprecated deprecated in favor of isHolidayKeyNotEmpty() - * @deprecated see isHolidayKeyNotEmpty() - */ - protected function isHolidayNameNotEmpty(string $key): bool - { - return $this->isHolidayKeyNotEmpty($key); - } - /** * Clear all holidays. */ diff --git a/src/Yasumi/Provider/Andorra.php b/src/Yasumi/Provider/Andorra.php new file mode 100644 index 000000000..c927682ae --- /dev/null +++ b/src/Yasumi/Provider/Andorra.php @@ -0,0 +1,176 @@ + + */ + +namespace Yasumi\Provider; + +use Yasumi\Exception\UnknownLocaleException; +use Yasumi\Holiday; + +/** + * Provider for all holidays in Andorra. + * + * Andorra observes 14 national public holidays. The official language is Catalan (ca_AD). + * The Principality of Andorra is a co-principality, with the President of France and + * the Bishop of Urgell serving as co-princes. + * + * @see https://en.wikipedia.org/wiki/Public_holidays_in_Andorra + */ +class Andorra extends AbstractProvider +{ + use CommonHolidays; + use ChristianHolidays; + + /** + * The year the Constitution of Andorra was signed and came into force. + */ + public const CONSTITUTION_YEAR = 1993; + + /** + * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'AD'; + + /** + * Initialize holidays for Andorra. + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + $this->timezone = 'Europe/Andorra'; + + // Add common holidays + $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale)); + + // Add Christian holidays + $this->addHoliday($this->epiphany($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->assumptionOfMary($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->immaculateConception($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale)); + + // Add Andorra-specific holidays + $this->calculateCarnival(); + $this->calculateConstitutionDay(); + $this->calculateMeritxellDay(); + } + + public function getSources(): array + { + return [ + 'https://en.wikipedia.org/wiki/Public_holidays_in_Andorra', + 'https://wit.ad/en/calendar-public-holidays-in-andorra/', + ]; + } + + /** + * Carnival (Dimarts Gras / Mardi Gras). + * + * Carnival in Andorra is celebrated on Shrove Tuesday (Mardi Gras), the day before Ash Wednesday. + * It falls 47 days before Easter Sunday and is one of the 14 official national public holidays. + * + * @see https://en.wikipedia.org/wiki/Carnival + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + protected function calculateCarnival(): void + { + $easter = $this->calculateEaster($this->year, $this->timezone); + $date = (clone $easter)->sub(new \DateInterval('P47D')); + + if (! $date instanceof \DateTime) { + throw new \RuntimeException(sprintf('unable to perform a date subtraction for %s:carnival', self::class)); + } + + $this->addHoliday(new Holiday( + 'carnival', + [ + 'ca' => 'Dimarts Gras', + 'en' => 'Carnival', + 'es' => 'Martes de Carnaval', + ], + $date, + $this->locale + )); + } + + /** + * Constitution Day. + * + * Constitution Day (Catalan: Dia de la Constitució) commemorates the signing of the Constitution of Andorra + * on 14 March 1993. The constitution established Andorra as a parliamentary co-principality. It is celebrated + * annually on 14 March. + * + * @see https://en.wikipedia.org/wiki/Constitution_of_Andorra + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + protected function calculateConstitutionDay(): void + { + if ($this->year >= self::CONSTITUTION_YEAR) { + $this->addHoliday(new Holiday( + 'constitutionDay', + [ + 'ca' => 'Dia de la Constitució', + 'en' => 'Constitution Day', + 'es' => 'Día de la Constitución', + ], + new \DateTime("{$this->year}-3-14", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + } + + /** + * Our Lady of Meritxell Day (National Day of Andorra). + * + * Our Lady of Meritxell Day (Catalan: Dia de la Mare de Déu de Meritxell) is the National Day of Andorra. + * It is celebrated on 8 September each year in honour of the Virgin of Meritxell, the patron saint of Andorra. + * The sanctuary of Our Lady of Meritxell is located in the parish of Canillo. + * + * @see https://en.wikipedia.org/wiki/Our_Lady_of_Meritxell + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + protected function calculateMeritxellDay(): void + { + $this->addHoliday(new Holiday( + 'meritxellDay', + [ + 'ca' => 'Dia de la Mare de Déu de Meritxell', + 'en' => 'Our Lady of Meritxell Day', + 'es' => 'Día de Nuestra Señora de Meritxell', + ], + new \DateTime("{$this->year}-9-8", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } +} diff --git a/src/Yasumi/Provider/SanMarino.php b/src/Yasumi/Provider/SanMarino.php new file mode 100644 index 000000000..7a25626f6 --- /dev/null +++ b/src/Yasumi/Provider/SanMarino.php @@ -0,0 +1,283 @@ + + */ + +namespace Yasumi\Provider; + +use Yasumi\Exception\UnknownLocaleException; +use Yasumi\Holiday; + +/** + * Provider for all holidays in San Marino. + * + * San Marino observes 18 national public holidays. The official language is Italian (it_SM). + * The Most Serene Republic of San Marino is one of the world's oldest republics, traditionally + * founded on 3 September 301 AD by Saint Marinus of Rab. + * + * @see https://en.wikipedia.org/wiki/Public_holidays_in_San_Marino + */ +class SanMarino extends AbstractProvider +{ + use CommonHolidays; + use ChristianHolidays; + + /** + * The year the Arengo (popular assembly) was reconvened, establishing democratic rights. + */ + public const ARENGO_YEAR = 1906; + + /** + * The year the Fall of Fascism holiday was first observed. + */ + public const FALL_OF_FASCISM_YEAR = 1944; + + /** + * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective + * country or sub-region. + */ + public const ID = 'SM'; + + /** + * Initialize holidays for San Marino. + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + $this->timezone = 'Europe/San_Marino'; + + // Add common holidays + $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->internationalWorkersDay($this->year, $this->timezone, $this->locale)); + + // Add Christian holidays + $this->addHoliday($this->epiphany($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->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL)); + $this->addHoliday($this->assumptionOfMary($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->immaculateConception($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale)); + + // Add San Marino-specific holidays + $this->calculateFeastOfSaintAgatha(); + $this->calculateAnniversaryOfArengo(); + $this->calculateInvestitureCaptainsRegentApril(); + $this->calculateFallOfFascism(); + $this->calculateFoundationDay(); + $this->calculateInvestitureCaptainsRegentOctober(); + $this->calculateCommemorationOfTheFallen(); + } + + public function getSources(): array + { + return [ + 'https://en.wikipedia.org/wiki/Public_holidays_in_San_Marino', + 'https://it.wikipedia.org/wiki/Festivit%C3%A0_di_San_Marino', + ]; + } + + /** + * Feast of Saint Agatha. + * + * The Feast of Saint Agatha (Italian: Festa di Sant'Agata) is celebrated on 5 February. Saint Agatha is the + * patron saint of San Marino. The day also commemorates the anniversary of the liberation of San Marino from + * the occupation by Cardinal Giulio Alberoni on 5 February 1740. + * + * @see https://en.wikipedia.org/wiki/Saint_Agatha + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + protected function calculateFeastOfSaintAgatha(): void + { + $this->addHoliday(new Holiday( + 'feastOfSaintAgatha', + [ + 'it' => "Festa di Sant\u{2019}Agata", + 'en' => 'Feast of Saint Agatha', + ], + new \DateTime("{$this->year}-2-5", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + + /** + * Anniversary of the Arengo. + * + * The Anniversary of the Arengo (Italian: Anniversario dell'Arengo) is celebrated on 25 March. The Arengo is + * the ancient popular assembly of San Marino. On 25 March 1906, the Arengo was reconvened after centuries, + * granting democratic rights including universal suffrage, marking a pivotal moment in San Marino's history. + * + * @see https://en.wikipedia.org/wiki/Arengo_(San_Marino) + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + protected function calculateAnniversaryOfArengo(): void + { + if ($this->year >= self::ARENGO_YEAR) { + $this->addHoliday(new Holiday( + 'anniversaryOfArengo', + [ + 'it' => "Anniversario dell\u{2019}Arengo", + 'en' => 'Anniversary of the Arengo', + ], + new \DateTime("{$this->year}-3-25", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + } + + /** + * Investiture of the Captains Regent (April). + * + * The Investiture of the Captains Regent (Italian: Investitura dei Capitani Reggenti) on 1 April marks the + * formal investiture ceremony of the two newly elected Captains Regent who serve as heads of state. The + * Captains Regent are elected twice yearly and serve a six-month term. This ceremony has been observed since + * the 13th century. + * + * @see https://en.wikipedia.org/wiki/Captain_Regent + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + protected function calculateInvestitureCaptainsRegentApril(): void + { + $this->addHoliday(new Holiday( + 'investitureCaptainsRegentApril', + [ + 'it' => 'Investitura dei Capitani Reggenti', + 'en' => 'Investiture of the Captains Regent', + ], + new \DateTime("{$this->year}-4-1", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + + /** + * Fall of Fascism. + * + * The Fall of Fascism (Italian: Caduta del Fascismo) is observed on 28 July, commemorating the coup d'état of + * 28 July 1943 when San Marino's Great and General Council voted to overthrow the Fascist government, ending + * the Fascist regime in the republic. The holiday has been observed since 1944. + * + * @see https://en.wikipedia.org/wiki/San_Marino_in_World_War_II + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + protected function calculateFallOfFascism(): void + { + if ($this->year >= self::FALL_OF_FASCISM_YEAR) { + $this->addHoliday(new Holiday( + 'fallOfFascism', + [ + 'it' => 'Caduta del Fascismo', + 'en' => 'Fall of Fascism', + ], + new \DateTime("{$this->year}-7-28", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + } + + /** + * Foundation Day (San Marino Day). + * + * Foundation Day (Italian: Anniversario della Fondazione della Repubblica), observed on 3 September, + * commemorates the traditional founding of the Republic of San Marino on 3 September 301 AD by Saint Marinus + * of Rab, a Christian stonemason from the island of Rab. It is also known as San Marino Day. + * + * @see https://en.wikipedia.org/wiki/San_Marino + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + protected function calculateFoundationDay(): void + { + $this->addHoliday(new Holiday( + 'foundationDay', + [ + 'it' => 'Anniversario della Fondazione della Repubblica', + 'en' => 'Foundation Day', + ], + new \DateTime("{$this->year}-9-3", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + + /** + * Investiture of the Captains Regent (October). + * + * The Investiture of the Captains Regent (Italian: Investitura dei Capitani Reggenti) on 1 October marks the + * formal investiture ceremony of the two newly elected Captains Regent. The ceremony is held twice yearly, + * on 1 April and 1 October. + * + * @see https://en.wikipedia.org/wiki/Captain_Regent + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + protected function calculateInvestitureCaptainsRegentOctober(): void + { + $this->addHoliday(new Holiday( + 'investitureCaptainsRegentOctober', + [ + 'it' => 'Investitura dei Capitani Reggenti', + 'en' => 'Investiture of the Captains Regent', + ], + new \DateTime("{$this->year}-10-1", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + + /** + * Commemoration of the Fallen. + * + * The Commemoration of the Fallen (Italian: Commemorazione dei Defunti), observed on 2 November, is a day + * to honour and remember all deceased persons. It coincides with All Souls' Day in the Catholic tradition + * and is an official public holiday in San Marino. + * + * @see https://en.wikipedia.org/wiki/All_Souls%27_Day + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + protected function calculateCommemorationOfTheFallen(): void + { + $this->addHoliday(new Holiday( + 'commemorationOfTheFallen', + [ + 'it' => 'Commemorazione dei Defunti', + 'en' => 'Commemoration of the Fallen', + ], + new \DateTime("{$this->year}-11-2", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } +} diff --git a/src/Yasumi/Provider/UnitedKingdom.php b/src/Yasumi/Provider/UnitedKingdom.php index ccaa5dba8..8744d1694 100644 --- a/src/Yasumi/Provider/UnitedKingdom.php +++ b/src/Yasumi/Provider/UnitedKingdom.php @@ -68,6 +68,7 @@ public function getSources(): array { return [ 'https://en.wikipedia.org/wiki/Public_holidays_in_the_United_Kingdom', + 'https://bank-holidays.uk/history-of-bank-holidays/', ]; } @@ -82,6 +83,7 @@ public function getSources(): array * often run to a holiday timetable. * * @see https://www.timeanddate.com/holidays/uk/early-may-bank-holiday + * @see https://bank-holidays.uk/history-of-bank-holidays/ * * @throws \InvalidArgumentException * @throws UnknownLocaleException @@ -126,6 +128,7 @@ protected function calculateMayDayBankHoliday(): void * * @see https://www.timeanddate.com/holidays/uk/spring-bank-holiday * @see https://en.wikipedia.org/wiki/Public_holidays_in_the_United_Kingdom + * @see https://bank-holidays.uk/history-of-bank-holidays/ * * @throws \InvalidArgumentException * @throws UnknownLocaleException @@ -317,6 +320,7 @@ protected function calculateChristmasHolidays(?string $type = null): void * * @see https://en.wikipedia.org/wiki/Public_holidays_in_the_United_Kingdom * @see https://www.timeanddate.com/holidays/uk/new-year-day + * @see https://bank-holidays.uk/history-of-bank-holidays/ * * @throws \InvalidArgumentException * @throws UnknownLocaleException @@ -330,7 +334,7 @@ protected function calculateNewYearsDay(): void } $type = Holiday::TYPE_BANK; - if ($this->year <= 1974) { + if ($this->year < 1974) { $type = Holiday::TYPE_OBSERVANCE; } diff --git a/src/Yasumi/Provider/UnitedKingdom/NorthernIreland.php b/src/Yasumi/Provider/UnitedKingdom/NorthernIreland.php index a88cfacc5..08f44b35e 100644 --- a/src/Yasumi/Provider/UnitedKingdom/NorthernIreland.php +++ b/src/Yasumi/Provider/UnitedKingdom/NorthernIreland.php @@ -56,6 +56,13 @@ public function initialize(): void $this->calculateBattleOfTheBoyne(); } + public function getSources(): array + { + return [ + 'https://nextbankholidays.co.uk/guides/battle-of-the-boyne/', + ]; + } + /** * St. Patrick's Day. * @@ -110,6 +117,7 @@ protected function calculateStPatricksDay(): void * Boyne (1690), which began the Protestant Ascendancy in Ireland. * * @see https://en.wikipedia.org/wiki/The_Twelfth + * @see https://nextbankholidays.co.uk/guides/battle-of-the-boyne/ * * @throws \InvalidArgumentException * @throws UnknownLocaleException diff --git a/src/Yasumi/Provider/UnitedKingdom/Scotland.php b/src/Yasumi/Provider/UnitedKingdom/Scotland.php index a46ae67d0..dae3e6fcc 100644 --- a/src/Yasumi/Provider/UnitedKingdom/Scotland.php +++ b/src/Yasumi/Provider/UnitedKingdom/Scotland.php @@ -66,7 +66,10 @@ public function initialize(): void public function getSources(): array { - return ['https://en.wikipedia.org/wiki/Public_and_bank_holidays_in_Scotland']; + return [ + 'https://en.wikipedia.org/wiki/Public_and_bank_holidays_in_Scotland', + 'https://bank-holidays.uk/history-of-bank-holidays/', + ]; } /** @@ -103,6 +106,8 @@ protected function calculateSummerBankHoliday(): void * If New Years Day falls on a Saturday, the following Monday and Tuesday are bank holidays. * * @see https://www.timeanddate.com/holidays/uk/new-year-day + * @see https://en.wikipedia.org/wiki/Public_holidays_in_the_United_Kingdom + * @see https://bank-holidays.uk/history-of-bank-holidays/ * * @throws \InvalidArgumentException * @throws UnknownLocaleException @@ -116,7 +121,7 @@ protected function calculateNewYearsHolidays(): void } $type = Holiday::TYPE_BANK; - if ($this->year <= 1974) { + if ($this->year < 1974) { $type = Holiday::TYPE_OBSERVANCE; } diff --git a/src/Yasumi/Provider/Venezuela.php b/src/Yasumi/Provider/Venezuela.php new file mode 100755 index 000000000..e6660882f --- /dev/null +++ b/src/Yasumi/Provider/Venezuela.php @@ -0,0 +1,288 @@ + + */ + +namespace Yasumi\Provider; + +use Yasumi\Exception\UnknownLocaleException; +use Yasumi\Holiday; + +/** + * Provider for all holidays in Venezuela. + * + * Venezuela observes 14 public holidays established by the Ley Orgánica del + * Trabajo, los Trabajadores y las Trabajadoras (LOTTT, Art. 184) and the + * Ley de Fiestas Nacionales (1971). + * + * @see https://en.wikipedia.org/wiki/Public_holidays_in_Venezuela + */ +class Venezuela extends AbstractProvider +{ + use CommonHolidays; + use ChristianHolidays; + + /** + * Year Venezuela declared the first act of independence (19 April 1810). + */ + public const DECLARATION_OF_INDEPENDENCE_YEAR = 1810; + + /** + * Year Venezuela formally declared full independence (5 July 1811). + */ + public const INDEPENDENCE_YEAR = 1811; + + /** + * Year of the Battle of Carabobo, which secured independence (24 June 1821). + */ + public const BATTLE_OF_CARABOBO_YEAR = 1821; + + /** + * Birth year of Simón Bolívar (24 July 1783). + */ + public const BOLIVAR_BIRTH_YEAR = 1783; + + /** + * Year Columbus arrived in the Americas (12 October 1492). + */ + public const COLUMBUS_YEAR = 1492; + + /** + * Year the holiday was renamed from "Día de la Raza" to + * "Día de la Resistencia Indígena" (Decreto 2028, 2002). + */ + public const INDIGENOUS_RESISTANCE_YEAR = 2002; + + /** + * Code to identify this Holiday Provider. Typically, this is the ISO3166 + * code corresponding to the respective country or sub-region. + */ + public const ID = 'VE'; + + /** + * Initialize holidays for Venezuela. + * + * @throws \InvalidArgumentException + * @throws UnknownLocaleException + * @throws \Exception + */ + public function initialize(): void + { + $this->timezone = 'America/Caracas'; + + // Fixed holidays defined in LOTTT Art. 184(b) + $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->maundyThursday($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->christmasEve($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL)); + $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale)); + $this->addHoliday($this->newYearsEve($this->year, $this->timezone, $this->locale)); + + // Carnival (LOTTT Art. 184(b): Monday and Tuesday before Easter) + $this->addCarnivalHolidays(); + + // Fixed holidays defined in Ley de Fiestas Nacionales + $this->addDeclarationOfIndependenceDay(); + $this->addBattleOfCaraboboDay(); + $this->addIndependenceDay(); + $this->addBolivarBirthdayDay(); + $this->addIndigenousResistanceDay(); + } + + /** + * The source of the holidays. + * + * @return string[] The source URLs + */ + public function getSources(): array + { + return [ + 'https://en.wikipedia.org/wiki/Public_holidays_in_Venezuela', + 'https://accesoalajusticia.org/glossary/dias-festivos/', + 'https://venezuela.justia.com/federales/leyes/ley-de-fiestas-nacionales/gdoc/', + 'https://www.asambleanacional.gob.ve/leyes/sancionadas/ley-de-reforma-parcial-de-la-ley-de-fiestas-nacionales', + ]; + } + + /** + * Carnival Monday and Tuesday. + * + * Established by LOTTT Art. 184(b). Carnival falls on the Monday and + * Tuesday immediately before Ash Wednesday (Easter − 48 and Easter − 47 days). + * + * @throws \Exception + */ + protected function addCarnivalHolidays(): void + { + $easter = $this->calculateEaster($this->year, $this->timezone); + + $days = [ + 'carnivalMonday' => [ + 'interval' => 'P48D', + 'es' => 'Lunes de Carnaval', + 'en' => 'Carnival Monday', + ], + 'carnivalTuesday' => [ + 'interval' => 'P47D', + 'es' => 'Martes de Carnaval', + 'en' => 'Carnival Tuesday', + ], + ]; + + foreach ($days as $key => $day) { + $date = (clone $easter)->sub(new \DateInterval($day['interval'])); + + if (! $date instanceof \DateTime) { + throw new \RuntimeException(sprintf('Unable to perform date subtraction for %s:%s', self::class, $key)); + } + + $this->addHoliday(new Holiday( + $key, + ['es' => $day['es'], 'en' => $day['en']], + $date, + $this->locale + )); + } + } + + /** + * Declaration of Independence Day (19 April). + * + * Commemorates the Caracas City Council's act of 19 April 1810 that + * removed the Spanish Captain-General, marking the start of Venezuela's + * independence movement. + * + * @see https://en.wikipedia.org/wiki/Venezuelan_Declaration_of_Independence + * + * @throws \Exception + */ + protected function addDeclarationOfIndependenceDay(): void + { + if ($this->year >= self::DECLARATION_OF_INDEPENDENCE_YEAR) { + $this->addHoliday(new Holiday( + 'declarationOfIndependenceDay', + [ + 'es' => 'Declaración de Independencia', + 'en' => 'Declaration of Independence Day', + ], + new \DateTime("{$this->year}-04-19", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + } + + /** + * Battle of Carabobo Day (24 June). + * + * Commemorates the decisive battle of 24 June 1821 that secured + * Venezuela's independence from Spain. + * + * @see https://en.wikipedia.org/wiki/Battle_of_Carabobo + * + * @throws \Exception + */ + protected function addBattleOfCaraboboDay(): void + { + if ($this->year >= self::BATTLE_OF_CARABOBO_YEAR) { + $this->addHoliday(new Holiday( + 'battleOfCaraboboDay', + [ + 'es' => 'Batalla de Carabobo', + 'en' => 'Battle of Carabobo Day', + ], + new \DateTime("{$this->year}-06-24", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + } + + /** + * Independence Day (5 July). + * + * Commemorates the formal Declaration of Independence signed by the + * Venezuelan Congress on 5 July 1811. + * + * @see https://en.wikipedia.org/wiki/Venezuelan_Declaration_of_Independence + * + * @throws \Exception + */ + protected function addIndependenceDay(): void + { + if ($this->year >= self::INDEPENDENCE_YEAR) { + $this->addHoliday(new Holiday( + 'independenceDay', + [ + 'es' => 'Día de la Independencia', + 'en' => 'Independence Day', + ], + new \DateTime("{$this->year}-07-05", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + } + + /** + * Simón Bolívar's Birthday (24 July). + * + * Commemorates the birth of Simón Bolívar, Liberator of Venezuela and + * five other South American nations, born on 24 July 1783. + * + * @see https://en.wikipedia.org/wiki/Sim%C3%B3n_Bol%C3%ADvar + * + * @throws \Exception + */ + protected function addBolivarBirthdayDay(): void + { + if ($this->year >= self::BOLIVAR_BIRTH_YEAR) { + $this->addHoliday(new Holiday( + 'bolivarBirthdayDay', + [ + 'es' => 'Natalicio de Simón Bolívar', + 'en' => 'Simón Bolívar’s Birthday', + ], + new \DateTime("{$this->year}-07-24", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + } + + /** + * Day of Indigenous Resistance / Columbus Day (12 October). + * + * Known as "Día de la Raza" (Columbus Day) until 2001. Renamed to + * "Día de la Resistencia Indígena" (Day of Indigenous Resistance) by + * Presidential Decree 2028 in 2002 under President Hugo Chávez. + * + * @see https://en.wikipedia.org/wiki/Day_of_Indigenous_Resistance + * + * @throws \Exception + */ + protected function addIndigenousResistanceDay(): void + { + if ($this->year >= self::COLUMBUS_YEAR) { + $name = $this->year >= self::INDIGENOUS_RESISTANCE_YEAR + ? ['es' => 'Día de la Resistencia Indígena', 'en' => 'Day of Indigenous Resistance'] + : ['es' => 'Día de la Raza', 'en' => 'Columbus Day']; + + $this->addHoliday(new Holiday( + 'indigenousResistanceDay', + $name, + new \DateTime("{$this->year}-10-12", DateTimeZoneFactory::getDateTimeZone($this->timezone)), + $this->locale + )); + } + } +} diff --git a/src/Yasumi/ProviderInterface.php b/src/Yasumi/ProviderInterface.php index d4122fd10..60c0d4737 100644 --- a/src/Yasumi/ProviderInterface.php +++ b/src/Yasumi/ProviderInterface.php @@ -30,9 +30,6 @@ */ interface ProviderInterface extends \Countable { - /** Initialize country holidays */ - public function initialize(): void; - /** * Returns a list of sources (i.e. references to websites, books, scientific papers, etc.) that are * used for determining the calculation logic of the providers' holidays. @@ -92,7 +89,7 @@ public function isHoliday(\DateTimeInterface $date): bool; /** * Get an iterator for the holidays. * - * @return \ArrayIterator iterator for the holidays of this calendar + * @return \ArrayIterator iterator for the holidays of this calendar */ public function getIterator(): \ArrayIterator; diff --git a/src/Yasumi/Yasumi.php b/src/Yasumi/Yasumi.php index fa63cfb71..25ad800be 100644 --- a/src/Yasumi/Yasumi.php +++ b/src/Yasumi/Yasumi.php @@ -150,7 +150,13 @@ public static function create(string $class, int $year = self::YEAR_LOWER_BOUND, throw new UnknownLocaleException(sprintf('Locale "%s" is not a valid locale.', $locale)); } - return new $providerClass($year, $locale, self::$globalTranslations); + $instance = new $providerClass($year, $locale, self::$globalTranslations); + + if (! $instance instanceof ProviderInterface) { + throw new ProviderNotFoundException(sprintf('Holiday provider "%s" does not implement ProviderInterface.', $class)); + } + + return $instance; } /** @@ -200,7 +206,7 @@ public static function createByISO3166_2( /** * Returns a list of available holiday providers. * - * @return array|string|null> list of available holiday providers + * @return array list of available holiday providers * * @throws \ReflectionException */ @@ -238,7 +244,13 @@ public static function getProviders(): array $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))); + if (! is_string($provider)) { + continue; + } + + /** @var class-string $providerClass */ + $providerClass = sprintf('Yasumi\Provider\%s', str_replace('/', '\\', $provider)); + $class = new \ReflectionClass($providerClass); $key = 'ID'; diff --git a/src/Yasumi/data/translations/battleOfCaraboboDay.php b/src/Yasumi/data/translations/battleOfCaraboboDay.php new file mode 100755 index 000000000..e8d843703 --- /dev/null +++ b/src/Yasumi/data/translations/battleOfCaraboboDay.php @@ -0,0 +1,22 @@ + + */ + +// Translations for Battle of Carabobo Day (Venezuela, 24 June) +return [ + 'en' => 'Battle of Carabobo Day', + 'es' => 'Batalla de Carabobo', +]; diff --git a/src/Yasumi/data/translations/bolivarBirthdayDay.php b/src/Yasumi/data/translations/bolivarBirthdayDay.php new file mode 100755 index 000000000..c5613dc82 --- /dev/null +++ b/src/Yasumi/data/translations/bolivarBirthdayDay.php @@ -0,0 +1,22 @@ + + */ + +// Translations for Simón Bolívar's Birthday (Venezuela, 24 July) +return [ + 'en' => 'Simón Bolívar’s Birthday', + 'es' => 'Natalicio de Simón Bolívar', +]; diff --git a/src/Yasumi/data/translations/christmasEve.php b/src/Yasumi/data/translations/christmasEve.php index df662b8e2..eda047916 100644 --- a/src/Yasumi/data/translations/christmasEve.php +++ b/src/Yasumi/data/translations/christmasEve.php @@ -23,6 +23,7 @@ 'da' => 'juleaften', 'de' => 'Heiliger Abend', 'en' => 'Christmas Eve', + 'es' => 'Nochebuena', 'et' => 'Jõululaupäev', 'fr' => 'Réveillon de Noël', 'it' => 'Vigilia di Natale', diff --git a/src/Yasumi/data/translations/declarationOfIndependenceDay.php b/src/Yasumi/data/translations/declarationOfIndependenceDay.php new file mode 100755 index 000000000..f3819ed8f --- /dev/null +++ b/src/Yasumi/data/translations/declarationOfIndependenceDay.php @@ -0,0 +1,22 @@ + + */ + +// Translations for Declaration of Independence Day (Venezuela, 19 April) +return [ + 'en' => 'Declaration of Independence Day', + 'es' => 'Declaración de Independencia', +]; diff --git a/src/Yasumi/data/translations/indigenousResistanceDay.php b/src/Yasumi/data/translations/indigenousResistanceDay.php new file mode 100755 index 000000000..4a32ad54f --- /dev/null +++ b/src/Yasumi/data/translations/indigenousResistanceDay.php @@ -0,0 +1,23 @@ + + */ + +// Translations for Day of Indigenous Resistance / Columbus Day (Venezuela, 12 October) +// Renamed from 'Día de la Raza' to 'Día de la Resistencia Indígena' in 2002 (Decreto 2028) +return [ + 'en' => 'Day of Indigenous Resistance', + 'es' => 'Día de la Resistencia Indígena', +]; diff --git a/src/Yasumi/data/translations/newYearsEve.php b/src/Yasumi/data/translations/newYearsEve.php index 802d78bf3..7a5c8abf4 100644 --- a/src/Yasumi/data/translations/newYearsEve.php +++ b/src/Yasumi/data/translations/newYearsEve.php @@ -20,6 +20,7 @@ 'da' => 'nytårsaften', 'de' => 'Silvester', 'en' => 'New Year’s Eve', + 'es' => 'Víspera de Año Nuevo', 'ko' => '신년전야', 'lv' => 'Vecgada vakars', 'sv' => 'nyårsafton', diff --git a/src/Yasumi/data/translations/pentecostMonday.php b/src/Yasumi/data/translations/pentecostMonday.php index f0031e21a..9816e2d54 100644 --- a/src/Yasumi/data/translations/pentecostMonday.php +++ b/src/Yasumi/data/translations/pentecostMonday.php @@ -17,6 +17,7 @@ // Translations for Whitmonday return [ + 'ca' => 'Dilluns de Pentecosta', 'da' => '2. pinsedag', 'de' => 'Pfingstmontag', 'el' => 'Αγίου Πνεύματος', diff --git a/tests/Andorra/AllSaintsDayTest.php b/tests/Andorra/AllSaintsDayTest.php new file mode 100644 index 000000000..c287c5456 --- /dev/null +++ b/tests/Andorra/AllSaintsDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for All Saints' Day in Andorra. + */ +class AllSaintsDayTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'allSaintsDay'; + + /** + * Tests All Saints' Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(11, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of All Saints' Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Dia de Tots Sants'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/AndorraBaseTestCase.php b/tests/Andorra/AndorraBaseTestCase.php new file mode 100644 index 000000000..9b34e159d --- /dev/null +++ b/tests/Andorra/AndorraBaseTestCase.php @@ -0,0 +1,40 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use PHPUnit\Framework\TestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the Andorra holiday provider. + */ +abstract class AndorraBaseTestCase extends TestCase +{ + use YasumiBase; + + /** + * Country (name) to be tested. + */ + public const REGION = 'Andorra'; + + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Europe/Andorra'; + + /** Locale that is considered common for this provider. */ + public const LOCALE = 'ca_AD'; +} diff --git a/tests/Andorra/AndorraTest.php b/tests/Andorra/AndorraTest.php new file mode 100644 index 000000000..bb132e0aa --- /dev/null +++ b/tests/Andorra/AndorraTest.php @@ -0,0 +1,114 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\Provider\Andorra; +use Yasumi\tests\ProviderTestCase; + +/** + * Class for testing holidays in Andorra. + */ +class AndorraTest extends AndorraBaseTestCase implements ProviderTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected int $year; + + /** + * Tests if all official holidays in Andorra are defined by the provider class. + * + * @throws \Exception + */ + public function testOfficialHolidays(): void + { + $year = static::generateRandomYear(); + + $holidays = [ + 'newYearsDay', + 'epiphany', + 'carnival', + 'goodFriday', + 'easterMonday', + 'internationalWorkersDay', + 'pentecostMonday', + 'assumptionOfMary', + 'meritxellDay', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + 'stStephensDay', + ]; + + if ($year >= Andorra::CONSTITUTION_YEAR) { + $holidays[] = 'constitutionDay'; + } + + $this->assertDefinedHolidays($holidays, self::REGION, $year, Holiday::TYPE_OFFICIAL); + } + + /** + * Tests if all observed holidays in Andorra are defined by the provider class. + * + * @throws \Exception + */ + public function testObservedHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); + } + + /** + * Tests if all seasonal holidays in Andorra are defined by the provider class. + * + * @throws \Exception + */ + public function testSeasonalHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_SEASON); + } + + /** + * Tests if all bank holidays in Andorra are defined by the provider class. + * + * @throws \Exception + */ + public function testBankHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_BANK); + } + + /** + * Tests if all other holidays in Andorra are defined by the provider class. + * + * @throws \Exception + */ + public function testOtherHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OTHER); + } + + /** + * @throws \ReflectionException + * @throws \Exception + */ + public function testSources(): void + { + $this->assertSources(self::REGION, 2); + } +} diff --git a/tests/Andorra/AssumptionOfMaryTest.php b/tests/Andorra/AssumptionOfMaryTest.php new file mode 100644 index 000000000..9f43879f3 --- /dev/null +++ b/tests/Andorra/AssumptionOfMaryTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for the Assumption of Mary in Andorra. + */ +class AssumptionOfMaryTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'assumptionOfMary'; + + /** + * Tests the Assumption of Mary. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(8, 15, self::TIMEZONE); + } + + /** + * Tests the translated name of the Assumption of Mary. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => "l\u{2019}Assumpció"] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/CarnivalTest.php b/tests/Andorra/CarnivalTest.php new file mode 100644 index 000000000..90d9ed580 --- /dev/null +++ b/tests/Andorra/CarnivalTest.php @@ -0,0 +1,93 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Carnival (Dimarts Gras) in Andorra. + */ +class CarnivalTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'carnival'; + + /** + * Tests Carnival (Shrove Tuesday / Mardi Gras). + * + * Carnival in Andorra falls on Shrove Tuesday, 47 days before Easter Sunday. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + * + * @throws \Exception + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of test dates used for assertion of Carnival. + * + * @return array list of test dates for Carnival + * + * @throws \Exception + */ + public static function HolidayDataProvider(): array + { + return [ + [2020, new \DateTime('2020-2-25', new \DateTimeZone(self::TIMEZONE))], + [2021, new \DateTime('2021-2-16', new \DateTimeZone(self::TIMEZONE))], + [2022, new \DateTime('2022-3-1', new \DateTimeZone(self::TIMEZONE))], + [2023, new \DateTime('2023-2-21', new \DateTimeZone(self::TIMEZONE))], + [2024, new \DateTime('2024-2-13', new \DateTimeZone(self::TIMEZONE))], + [2025, new \DateTime('2025-3-4', new \DateTimeZone(self::TIMEZONE))], + [2026, new \DateTime('2026-2-17', new \DateTimeZone(self::TIMEZONE))], + ]; + } + + /** + * Tests the translated name of Carnival. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Dimarts Gras'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/ChristmasDayTest.php b/tests/Andorra/ChristmasDayTest.php new file mode 100644 index 000000000..d21039373 --- /dev/null +++ b/tests/Andorra/ChristmasDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Christmas Day in Andorra. + */ +class ChristmasDayTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'christmasDay'; + + /** + * Tests Christmas Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(12, 25, self::TIMEZONE); + } + + /** + * Tests the translated name of Christmas Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Nadal'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/ConstitutionDayTest.php b/tests/Andorra/ConstitutionDayTest.php new file mode 100644 index 000000000..b7c0570ee --- /dev/null +++ b/tests/Andorra/ConstitutionDayTest.php @@ -0,0 +1,98 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\Provider\Andorra; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Constitution Day in Andorra. + */ +class ConstitutionDayTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'constitutionDay'; + + /** + * The year in which Constitution Day was established. + */ + public const ESTABLISHMENT_YEAR = 1993; + + /** + * Tests Constitution Day on or after 1993. + * + * @throws \Exception + */ + public function testConstitutionDayOnAfter1993(): void + { + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-3-14", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests Constitution Day before 1993 (should not exist). + * + * @throws \Exception + */ + public function testConstitutionDayBefore1993(): void + { + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + ); + } + + /** + * Tests the translated name of Constitution Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Dia de la Constitució'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(self::ESTABLISHMENT_YEAR), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/Andorra/EasterMondayTest.php b/tests/Andorra/EasterMondayTest.php new file mode 100644 index 000000000..dab887148 --- /dev/null +++ b/tests/Andorra/EasterMondayTest.php @@ -0,0 +1,73 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Easter Monday in Andorra. + */ +class EasterMondayTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'easterMonday'; + + /** + * Tests Easter Monday. + * + * @throws \Exception + */ + public function testEasterMonday(): void + { + $year = 2026; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-4-6", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests the translated name of Easter Monday. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'dilluns de Pasqua'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/EpiphanyTest.php b/tests/Andorra/EpiphanyTest.php new file mode 100644 index 000000000..c69919817 --- /dev/null +++ b/tests/Andorra/EpiphanyTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Epiphany in Andorra. + */ +class EpiphanyTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'epiphany'; + + /** + * Tests the holiday defined in this test. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(1, 6, self::TIMEZONE); + } + + /** + * Tests the translated name of the holiday defined in this test. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Epifania'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/GoodFridayTest.php b/tests/Andorra/GoodFridayTest.php new file mode 100644 index 000000000..b02658685 --- /dev/null +++ b/tests/Andorra/GoodFridayTest.php @@ -0,0 +1,73 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Good Friday in Andorra. + */ +class GoodFridayTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'goodFriday'; + + /** + * Tests Good Friday. + * + * @throws \Exception + */ + public function testGoodFriday(): void + { + $year = 2026; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-4-3", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests the translated name of Good Friday. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Divendres Sant'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/ImmaculateConceptionTest.php b/tests/Andorra/ImmaculateConceptionTest.php new file mode 100644 index 000000000..1b5b46bf9 --- /dev/null +++ b/tests/Andorra/ImmaculateConceptionTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for the Immaculate Conception in Andorra. + */ +class ImmaculateConceptionTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'immaculateConception'; + + /** + * Tests the Immaculate Conception. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(12, 8, self::TIMEZONE); + } + + /** + * Tests the translated name of the Immaculate Conception. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Immaculada Concepció'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/InternationalWorkersDayTest.php b/tests/Andorra/InternationalWorkersDayTest.php new file mode 100644 index 000000000..4a00bc66a --- /dev/null +++ b/tests/Andorra/InternationalWorkersDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for International Workers' Day in Andorra. + */ +class InternationalWorkersDayTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'internationalWorkersDay'; + + /** + * Tests International Workers' Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(5, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of International Workers' Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Dia del Treball'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/MeritxellDayTest.php b/tests/Andorra/MeritxellDayTest.php new file mode 100644 index 000000000..de1e04d2e --- /dev/null +++ b/tests/Andorra/MeritxellDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Our Lady of Meritxell Day (National Day) in Andorra. + */ +class MeritxellDayTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'meritxellDay'; + + /** + * Tests Our Lady of Meritxell Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(9, 8, self::TIMEZONE); + } + + /** + * Tests the translated name of Our Lady of Meritxell Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Dia de la Mare de Déu de Meritxell'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/NewYearsDayTest.php b/tests/Andorra/NewYearsDayTest.php new file mode 100644 index 000000000..e1265451c --- /dev/null +++ b/tests/Andorra/NewYearsDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for New Year's Day in Andorra. + */ +class NewYearsDayTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'newYearsDay'; + + /** + * Tests New Year's Day. + * + * @param int $year the year for which New Year's Day needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); + } + + /** + * Returns a list of random test dates used for assertion of New Year's Day. + * + * @return array list of test dates for New Year's Day + * + * @throws \Exception + */ + public static function HolidayDataProvider(): array + { + return static::generateRandomDates(1, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of New Year's Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => "Cap d\u{2019}any"] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/PentecostMondayTest.php b/tests/Andorra/PentecostMondayTest.php new file mode 100644 index 000000000..8136e626d --- /dev/null +++ b/tests/Andorra/PentecostMondayTest.php @@ -0,0 +1,73 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Pentecost Monday (Whit Monday) in Andorra. + */ +class PentecostMondayTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'pentecostMonday'; + + /** + * Tests Pentecost Monday. + * + * @throws \Exception + */ + public function testPentecostMonday(): void + { + $year = 2026; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-5-25", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests the translated name of Pentecost Monday. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Dilluns de Pentecosta'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Andorra/StStephensDayTest.php b/tests/Andorra/StStephensDayTest.php new file mode 100644 index 000000000..efe85b385 --- /dev/null +++ b/tests/Andorra/StStephensDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\Andorra; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for St. Stephen's Day in Andorra. + */ +class StStephensDayTest extends AndorraBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'stStephensDay'; + + /** + * Tests St. Stephen's Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(12, 26, self::TIMEZONE); + } + + /** + * Tests the translated name of St. Stephen's Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Sant Esteve'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Argentina/ArgentinaTest.php b/tests/Argentina/ArgentinaTest.php index ba0a15432..416442c37 100644 --- a/tests/Argentina/ArgentinaTest.php +++ b/tests/Argentina/ArgentinaTest.php @@ -38,7 +38,7 @@ class ArgentinaTest extends ArgentinaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1980); + $this->year = static::generateRandomYear(1980); } /** diff --git a/tests/Argentina/CarnavalMondayTest.php b/tests/Argentina/CarnavalMondayTest.php index 8f98933f1..a702d8cbd 100644 --- a/tests/Argentina/CarnavalMondayTest.php +++ b/tests/Argentina/CarnavalMondayTest.php @@ -45,12 +45,12 @@ class CarnavalMondayTest extends ArgentinaBaseTestCase implements HolidayTestCas */ public function testCarnavalMondayAfter1700(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->sub(new \DateInterval('P48D')) + static::computeEaster($year, self::TIMEZONE)->sub(new \DateInterval('P48D')) ); } @@ -61,7 +61,7 @@ public function testCarnavalMondayAfter1700(): void */ public function testCarnavalMondayBefore1700(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -72,7 +72,7 @@ public function testCarnavalMondayBefore1700(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Lunes de Carnaval']); } @@ -83,7 +83,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/CarnavalTuesdayTest.php b/tests/Argentina/CarnavalTuesdayTest.php index efb6de999..8506abbfc 100644 --- a/tests/Argentina/CarnavalTuesdayTest.php +++ b/tests/Argentina/CarnavalTuesdayTest.php @@ -45,12 +45,12 @@ class CarnavalTuesdayTest extends ArgentinaBaseTestCase implements HolidayTestCa */ public function testCarnavalTuesdayAfter1700(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->sub(new \DateInterval('P47D')) + static::computeEaster($year, self::TIMEZONE)->sub(new \DateInterval('P47D')) ); } @@ -61,7 +61,7 @@ public function testCarnavalTuesdayAfter1700(): void */ public function testCarnavalTuesdayBefore1700(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -72,7 +72,7 @@ public function testCarnavalTuesdayBefore1700(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Martes de Carnaval']); } @@ -83,7 +83,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/ChristmasDayTest.php b/tests/Argentina/ChristmasDayTest.php index b8d34f018..b3feccbc0 100644 --- a/tests/Argentina/ChristmasDayTest.php +++ b/tests/Argentina/ChristmasDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Navidad'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/EasterTest.php b/tests/Argentina/EasterTest.php index 3d1982a68..eebe388e4 100644 --- a/tests/Argentina/EasterTest.php +++ b/tests/Argentina/EasterTest.php @@ -41,7 +41,7 @@ class EasterTest extends ArgentinaBaseTestCase implements HolidayTestCase public function testEaster(): void { $year = 1948; - $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $this->calculateEaster($year, self::TIMEZONE)); + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, static::computeEaster($year, self::TIMEZONE)); } /** @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pascua de Resurrección'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Argentina/FlagDayTest.php b/tests/Argentina/FlagDayTest.php index 203843ceb..ca951a176 100644 --- a/tests/Argentina/FlagDayTest.php +++ b/tests/Argentina/FlagDayTest.php @@ -69,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Paso a la Inmortalidad del General Manuel Belgrano'] ); } @@ -81,6 +81,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/GeneralJoseSanMartinDayTest.php b/tests/Argentina/GeneralJoseSanMartinDayTest.php index 33000b4f6..d7d015098 100644 --- a/tests/Argentina/GeneralJoseSanMartinDayTest.php +++ b/tests/Argentina/GeneralJoseSanMartinDayTest.php @@ -99,7 +99,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Paso a la Inmortalidad del General José de San Martín'] ); } @@ -111,6 +111,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/GeneralMartinMigueldeGuemesDayTest.php b/tests/Argentina/GeneralMartinMigueldeGuemesDayTest.php index 3f616790e..aaa2d7e7f 100644 --- a/tests/Argentina/GeneralMartinMigueldeGuemesDayTest.php +++ b/tests/Argentina/GeneralMartinMigueldeGuemesDayTest.php @@ -114,7 +114,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Paso a la Inmortalidad del General Martín Miguel de Güemes'] ); } @@ -126,6 +126,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/GoodFridayTest.php b/tests/Argentina/GoodFridayTest.php index 27b4d163b..dbd93b12e 100644 --- a/tests/Argentina/GoodFridayTest.php +++ b/tests/Argentina/GoodFridayTest.php @@ -45,7 +45,7 @@ public function testGoodFriday(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->sub(new \DateInterval('P2D')) + static::computeEaster($year, self::TIMEZONE)->sub(new \DateInterval('P2D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Viernes Santo'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/ImmaculateConceptionDayTest.php b/tests/Argentina/ImmaculateConceptionDayTest.php index becb492b9..a81b55476 100644 --- a/tests/Argentina/ImmaculateConceptionDayTest.php +++ b/tests/Argentina/ImmaculateConceptionDayTest.php @@ -69,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de la Inmaculada Concepción de María'] ); } @@ -81,6 +81,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/IndependenceDayTest.php b/tests/Argentina/IndependenceDayTest.php index 1594caade..78ba51f72 100644 --- a/tests/Argentina/IndependenceDayTest.php +++ b/tests/Argentina/IndependenceDayTest.php @@ -69,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de la Independencia'] ); } @@ -81,6 +81,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/InternationalWorkersDayTest.php b/tests/Argentina/InternationalWorkersDayTest.php index ce591ff36..270385b56 100644 --- a/tests/Argentina/InternationalWorkersDayTest.php +++ b/tests/Argentina/InternationalWorkersDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Día del Trabajador'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/MalvinasDayTest.php b/tests/Argentina/MalvinasDayTest.php index 01910a058..eb73bba02 100644 --- a/tests/Argentina/MalvinasDayTest.php +++ b/tests/Argentina/MalvinasDayTest.php @@ -69,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día del Veterano y de los Caídos en la Guerra de Malvinas'] ); } @@ -81,6 +81,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/MayRevolutionTest.php b/tests/Argentina/MayRevolutionTest.php index b3fef7739..a2a2f9fe2 100644 --- a/tests/Argentina/MayRevolutionTest.php +++ b/tests/Argentina/MayRevolutionTest.php @@ -69,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de la Revolución de Mayo'] ); } @@ -81,6 +81,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/NationalSovereigntyDayTest.php b/tests/Argentina/NationalSovereigntyDayTest.php index a817fc816..40d52230c 100644 --- a/tests/Argentina/NationalSovereigntyDayTest.php +++ b/tests/Argentina/NationalSovereigntyDayTest.php @@ -99,7 +99,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de la Soberanía Nacional'] ); } @@ -111,6 +111,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/NewYearsDayTest.php b/tests/Argentina/NewYearsDayTest.php index 600c9a0e5..17f10a9fd 100644 --- a/tests/Argentina/NewYearsDayTest.php +++ b/tests/Argentina/NewYearsDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Año Nuevo'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/RaceDayTest.php b/tests/Argentina/RaceDayTest.php index 749f8a33c..a84a465ed 100644 --- a/tests/Argentina/RaceDayTest.php +++ b/tests/Argentina/RaceDayTest.php @@ -99,7 +99,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día del Respeto a la Diversidad Cultural'] ); } @@ -111,6 +111,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Argentina/RemembranceDayTest.php b/tests/Argentina/RemembranceDayTest.php index 3223a7ae7..f74a96624 100644 --- a/tests/Argentina/RemembranceDayTest.php +++ b/tests/Argentina/RemembranceDayTest.php @@ -42,7 +42,7 @@ class RemembranceDayTest extends ArgentinaBaseTestCase implements HolidayTestCas */ public function testRemembranceDayAfter2006(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testRemembranceDayAfter2006(): void */ public function testRemembranceDayBefore2006(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -69,7 +69,7 @@ public function testRemembranceDayBefore2006(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Día Nacional de la Memoria por la Verdad y la Justicia']); } @@ -80,7 +80,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/AnzacDayTest.php b/tests/Australia/AnzacDayTest.php index caaed13ea..ccda08d7c 100644 --- a/tests/Australia/AnzacDayTest.php +++ b/tests/Australia/AnzacDayTest.php @@ -38,13 +38,12 @@ class AnzacDayTest extends AustraliaBaseTestCase implements HolidayTestCase /** * Tests ANZAC 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -68,7 +67,7 @@ public function testNotHoliday(): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-04-25'], @@ -96,7 +95,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'ANZAC Day'] ); } @@ -111,7 +110,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/AustraliaBaseTestCase.php b/tests/Australia/AustraliaBaseTestCase.php index 8e6fffe64..cf0011175 100644 --- a/tests/Australia/AustraliaBaseTestCase.php +++ b/tests/Australia/AustraliaBaseTestCase.php @@ -30,9 +30,11 @@ abstract class AustraliaBaseTestCase extends TestCase /** Locale that is considered common for this provider. */ public const LOCALE = 'en_AU'; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/Melbourne'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/Melbourne'; } diff --git a/tests/Australia/AustraliaDayTest.php b/tests/Australia/AustraliaDayTest.php index c5da5f815..d405aadb7 100644 --- a/tests/Australia/AustraliaDayTest.php +++ b/tests/Australia/AustraliaDayTest.php @@ -33,11 +33,10 @@ class AustraliaDayTest extends AustraliaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday($this->region, self::HOLIDAY, $year, $expected); @@ -46,13 +45,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void /** * Tests Australia Day. * - * @dataProvider SubstituteHolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param ?string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('SubstituteHolidayDataProvider')] public function testSubstituteHoliday(int $year, ?string $expected): void { if ($expected) { @@ -81,7 +79,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(2000), + static::generateRandomYear(2000), [self::LOCALE => 'Australia Day'] ); } @@ -93,7 +91,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(2000), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(2000), Holiday::TYPE_OFFICIAL); } /** @@ -103,9 +101,9 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 26, $this->timezone); + return static::generateRandomDates(1, 26, 'Australia/Melbourne'); } /** @@ -113,7 +111,7 @@ public function HolidayDataProvider(): array * * @return array list of test dates for the holiday defined in this test */ - public function SubstituteHolidayDataProvider(): array + public static function SubstituteHolidayDataProvider(): array { return [ [2010, null], diff --git a/tests/Australia/AustraliaTest.php b/tests/Australia/AustraliaTest.php index ca22b50a9..d3c74d0da 100644 --- a/tests/Australia/AustraliaTest.php +++ b/tests/Australia/AustraliaTest.php @@ -37,7 +37,7 @@ class AustraliaTest extends AustraliaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1987); + $this->year = static::generateRandomYear(1987); } /** diff --git a/tests/Australia/AustralianCapitalTerritory/AustralianCapitalTerritoryBaseTestCase.php b/tests/Australia/AustralianCapitalTerritory/AustralianCapitalTerritoryBaseTestCase.php index 2cf598c3c..b92905446 100644 --- a/tests/Australia/AustralianCapitalTerritory/AustralianCapitalTerritoryBaseTestCase.php +++ b/tests/Australia/AustralianCapitalTerritory/AustralianCapitalTerritoryBaseTestCase.php @@ -27,9 +27,11 @@ abstract class AustralianCapitalTerritoryBaseTestCase extends AustraliaBaseTestC { use YasumiBase; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/ACT'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia\AustralianCapitalTerritory'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/ACT'; } diff --git a/tests/Australia/AustralianCapitalTerritory/AustralianCapitalTerritoryTest.php b/tests/Australia/AustralianCapitalTerritory/AustralianCapitalTerritoryTest.php index 5ade1ab25..fd4717c6c 100644 --- a/tests/Australia/AustralianCapitalTerritory/AustralianCapitalTerritoryTest.php +++ b/tests/Australia/AustralianCapitalTerritory/AustralianCapitalTerritoryTest.php @@ -37,7 +37,7 @@ class AustralianCapitalTerritoryTest extends AustralianCapitalTerritoryBaseTestC */ protected function setUp(): void { - $this->year = $this->generateRandomYear(2018, 2100); + $this->year = static::generateRandomYear(2018, 2100); } /** diff --git a/tests/Australia/AustralianCapitalTerritory/CanberraDayTest.php b/tests/Australia/AustralianCapitalTerritory/CanberraDayTest.php index a06c37590..ec5dff140 100644 --- a/tests/Australia/AustralianCapitalTerritory/CanberraDayTest.php +++ b/tests/Australia/AustralianCapitalTerritory/CanberraDayTest.php @@ -38,13 +38,12 @@ class CanberraDayTest extends AustralianCapitalTerritoryBaseTestCase implements /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-03-08'], @@ -87,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Canberra Day'] ); } @@ -102,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/AustralianCapitalTerritory/EasterSaturdayTest.php b/tests/Australia/AustralianCapitalTerritory/EasterSaturdayTest.php index bfdb43587..7c132ebcb 100644 --- a/tests/Australia/AustralianCapitalTerritory/EasterSaturdayTest.php +++ b/tests/Australia/AustralianCapitalTerritory/EasterSaturdayTest.php @@ -33,13 +33,12 @@ class EasterSaturdayTest extends AustralianCapitalTerritoryBaseTestCase implemen /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, $this->timezone); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->sub(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Saturday'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/AustralianCapitalTerritory/EasterSundayTest.php b/tests/Australia/AustralianCapitalTerritory/EasterSundayTest.php index 54b20fec2..4aaa6924d 100644 --- a/tests/Australia/AustralianCapitalTerritory/EasterSundayTest.php +++ b/tests/Australia/AustralianCapitalTerritory/EasterSundayTest.php @@ -33,13 +33,12 @@ class EasterSundayTest extends AustralianCapitalTerritoryBaseTestCase implements /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, $this->timezone); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $data[] = [$year, $date->format('Y-m-d')]; } @@ -81,7 +80,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Sunday'] ); } @@ -93,6 +92,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/AustralianCapitalTerritory/LabourDayTest.php b/tests/Australia/AustralianCapitalTerritory/LabourDayTest.php index c4858b44f..a8abe5d77 100644 --- a/tests/Australia/AustralianCapitalTerritory/LabourDayTest.php +++ b/tests/Australia/AustralianCapitalTerritory/LabourDayTest.php @@ -33,13 +33,12 @@ class LabourDayTest extends AustralianCapitalTerritoryBaseTestCase implements Ho /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-10-04'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Labour Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/AustralianCapitalTerritory/QueensBirthdayTest.php b/tests/Australia/AustralianCapitalTerritory/QueensBirthdayTest.php index bed25cbb4..b945dcf3f 100644 --- a/tests/Australia/AustralianCapitalTerritory/QueensBirthdayTest.php +++ b/tests/Australia/AustralianCapitalTerritory/QueensBirthdayTest.php @@ -38,13 +38,12 @@ class QueensBirthdayTest extends AustralianCapitalTerritoryBaseTestCase implemen /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-06-14'], @@ -87,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Queen’s Birthday'] ); } @@ -102,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/AustralianCapitalTerritory/ReconciliationDayTest.php b/tests/Australia/AustralianCapitalTerritory/ReconciliationDayTest.php index f242a5afe..f6273aa9e 100644 --- a/tests/Australia/AustralianCapitalTerritory/ReconciliationDayTest.php +++ b/tests/Australia/AustralianCapitalTerritory/ReconciliationDayTest.php @@ -38,13 +38,12 @@ class ReconciliationDayTest extends AustralianCapitalTerritoryBaseTestCase imple /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2018, '2018-05-28'], @@ -89,7 +88,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Reconciliation Day'] ); } @@ -104,7 +103,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/BoxingDayTest.php b/tests/Australia/BoxingDayTest.php index e7543828c..acad8315d 100644 --- a/tests/Australia/BoxingDayTest.php +++ b/tests/Australia/BoxingDayTest.php @@ -34,14 +34,13 @@ class BoxingDayTest extends AustraliaBaseTestCase implements HolidayTestCase /** * 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 ?string $expectedExtra the expected date for the additional holiday, or null if no additional holiday * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected, ?string $expectedExtra): void { $this->assertHoliday( @@ -71,7 +70,7 @@ public function testHoliday(int $year, string $expected, ?string $expectedExtra) * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-12-26', '2010-12-28'], @@ -98,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Boxing Day'] ); $this->assertTranslatedHolidayName( @@ -116,7 +115,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::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 c5bd7c7fc..cf18119a6 100644 --- a/tests/Australia/ChristmasDayTest.php +++ b/tests/Australia/ChristmasDayTest.php @@ -34,14 +34,13 @@ class ChristmasDayTest extends AustraliaBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected, ?string $expectedExtra): void { $this->assertHoliday( @@ -71,7 +70,7 @@ public function testHoliday(int $year, string $expected, ?string $expectedExtra) * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-12-25', '2010-12-27'], @@ -98,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); $this->assertTranslatedHolidayName( @@ -116,7 +115,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::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 e3a1e7d65..228bb0299 100644 --- a/tests/Australia/EasterMondayTest.php +++ b/tests/Australia/EasterMondayTest.php @@ -34,13 +34,12 @@ class EasterMondayTest extends AustraliaBaseTestCase implements HolidayTestCase /** * Tests Easter Monday. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -54,13 +53,12 @@ public function testHoliday(int $year, string $expected): void /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider2')] public function testHoliday2(int $year, string $expected): void { $this->assertHoliday( @@ -78,13 +76,13 @@ public function testHoliday2(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, $this->timezone); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->add(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -98,7 +96,7 @@ public function HolidayDataProvider(): array * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider2(): array + public static function HolidayDataProvider2(): array { return [ [2011, '2011-04-26'], @@ -118,7 +116,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Monday'] ); $this->assertTranslatedHolidayName( @@ -136,7 +134,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::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 8df450583..f08e65007 100644 --- a/tests/Australia/GoodFridayTest.php +++ b/tests/Australia/GoodFridayTest.php @@ -33,13 +33,12 @@ class GoodFridayTest extends AustraliaBaseTestCase implements HolidayTestCase /** * Tests Good Friday. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, $this->timezone); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->sub(new \DateInterval('P2D')); $data[] = [$year, $date->format('Y-m-d')]; } @@ -81,7 +80,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Good Friday'] ); } @@ -93,6 +92,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/NationalDayOfMourningTest.php b/tests/Australia/NationalDayOfMourningTest.php index b942c6bd1..90b5045f8 100644 --- a/tests/Australia/NationalDayOfMourningTest.php +++ b/tests/Australia/NationalDayOfMourningTest.php @@ -65,7 +65,7 @@ public function testHolidayBeforeActive(): void $this->assertNotHoliday( $this->region, self::HOLIDAY, - $this->generateRandomYear(1000, self::ACTIVE_YEAR - 1) + static::generateRandomYear(1000, self::ACTIVE_YEAR - 1) ); } @@ -79,7 +79,7 @@ public function testHolidayAfterActive(): void $this->assertNotHoliday( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ACTIVE_YEAR + 1) + static::generateRandomYear(self::ACTIVE_YEAR + 1) ); } diff --git a/tests/Australia/NewSouthWales/BankHolidayTest.php b/tests/Australia/NewSouthWales/BankHolidayTest.php index 66d3e8d2d..0031a2df1 100644 --- a/tests/Australia/NewSouthWales/BankHolidayTest.php +++ b/tests/Australia/NewSouthWales/BankHolidayTest.php @@ -33,13 +33,12 @@ class BankHolidayTest extends NewSouthWalesBaseTestCase implements HolidayTestCa /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-08-02'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Bank Holiday'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_BANK); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_BANK); } } diff --git a/tests/Australia/NewSouthWales/EasterSaturdayTest.php b/tests/Australia/NewSouthWales/EasterSaturdayTest.php index 6e5ad230b..7eaf9321d 100644 --- a/tests/Australia/NewSouthWales/EasterSaturdayTest.php +++ b/tests/Australia/NewSouthWales/EasterSaturdayTest.php @@ -33,13 +33,12 @@ class EasterSaturdayTest extends NewSouthWalesBaseTestCase implements HolidayTes /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, $this->timezone); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->sub(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Saturday'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/NewSouthWales/EasterSundayTest.php b/tests/Australia/NewSouthWales/EasterSundayTest.php index e974e0eb4..6abf6b4f2 100644 --- a/tests/Australia/NewSouthWales/EasterSundayTest.php +++ b/tests/Australia/NewSouthWales/EasterSundayTest.php @@ -33,13 +33,12 @@ class EasterSundayTest extends NewSouthWalesBaseTestCase implements HolidayTestC /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, $this->timezone); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $data[] = [$year, $date->format('Y-m-d')]; } @@ -81,7 +80,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Sunday'] ); } @@ -93,6 +92,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/NewSouthWales/LabourDayTest.php b/tests/Australia/NewSouthWales/LabourDayTest.php index ee58b4ceb..2d241e693 100644 --- a/tests/Australia/NewSouthWales/LabourDayTest.php +++ b/tests/Australia/NewSouthWales/LabourDayTest.php @@ -33,13 +33,12 @@ class LabourDayTest extends NewSouthWalesBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-10-04'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Labour Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/NewSouthWales/NewSouthWalesBaseTestCase.php b/tests/Australia/NewSouthWales/NewSouthWalesBaseTestCase.php index f3c1a6c3e..a2e8f801a 100644 --- a/tests/Australia/NewSouthWales/NewSouthWalesBaseTestCase.php +++ b/tests/Australia/NewSouthWales/NewSouthWalesBaseTestCase.php @@ -27,9 +27,11 @@ abstract class NewSouthWalesBaseTestCase extends AustraliaBaseTestCase { use YasumiBase; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/NSW'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia\NewSouthWales'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/NSW'; } diff --git a/tests/Australia/NewSouthWales/NewSouthWalesTest.php b/tests/Australia/NewSouthWales/NewSouthWalesTest.php index 8cc817b1d..995eec31f 100644 --- a/tests/Australia/NewSouthWales/NewSouthWalesTest.php +++ b/tests/Australia/NewSouthWales/NewSouthWalesTest.php @@ -37,7 +37,7 @@ class NewSouthWalesTest extends NewSouthWalesBaseTestCase implements ProviderTes */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/NewSouthWales/QueensBirthdayTest.php b/tests/Australia/NewSouthWales/QueensBirthdayTest.php index 41b51e1ff..a81507681 100644 --- a/tests/Australia/NewSouthWales/QueensBirthdayTest.php +++ b/tests/Australia/NewSouthWales/QueensBirthdayTest.php @@ -38,13 +38,12 @@ class QueensBirthdayTest extends NewSouthWalesBaseTestCase implements HolidayTes /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-06-14'], @@ -87,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Queen’s Birthday'] ); } @@ -102,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/NewYearsDayTest.php b/tests/Australia/NewYearsDayTest.php index 1e56628cc..8af3fe44f 100644 --- a/tests/Australia/NewYearsDayTest.php +++ b/tests/Australia/NewYearsDayTest.php @@ -34,14 +34,13 @@ class NewYearsDayTest extends AustraliaBaseTestCase implements HolidayTestCase /** * 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 ?string $expectedExtra the expected date for the additional holiday, or null if no additional holiday * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected, ?string $expectedExtra): void { $this->assertHoliday( @@ -71,7 +70,7 @@ public function testHoliday(int $year, string $expected, ?string $expectedExtra) * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-01-01', null], @@ -98,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'New Year’s Day'] ); $this->assertTranslatedHolidayName( @@ -116,7 +115,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); $this->assertHolidayType($this->region, self::HOLIDAY2, 2017, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/NorthernTerritory/EasterSaturdayTest.php b/tests/Australia/NorthernTerritory/EasterSaturdayTest.php index 23f38e309..8c9b5547a 100644 --- a/tests/Australia/NorthernTerritory/EasterSaturdayTest.php +++ b/tests/Australia/NorthernTerritory/EasterSaturdayTest.php @@ -33,13 +33,12 @@ class EasterSaturdayTest extends NorthernTerritoryBaseTestCase implements Holida /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, $this->timezone); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->sub(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Saturday'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/NorthernTerritory/MayDayTest.php b/tests/Australia/NorthernTerritory/MayDayTest.php index 38e9a0d0b..fb719510e 100644 --- a/tests/Australia/NorthernTerritory/MayDayTest.php +++ b/tests/Australia/NorthernTerritory/MayDayTest.php @@ -33,13 +33,12 @@ class MayDayTest extends NorthernTerritoryBaseTestCase implements HolidayTestCas /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-05-03'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'May Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/NorthernTerritory/NorthernTerritoryBaseTestCase.php b/tests/Australia/NorthernTerritory/NorthernTerritoryBaseTestCase.php index 1a61a7cff..d4be2ce9d 100644 --- a/tests/Australia/NorthernTerritory/NorthernTerritoryBaseTestCase.php +++ b/tests/Australia/NorthernTerritory/NorthernTerritoryBaseTestCase.php @@ -27,9 +27,11 @@ abstract class NorthernTerritoryBaseTestCase extends AustraliaBaseTestCase { use YasumiBase; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/North'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia\NorthernTerritory'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/North'; } diff --git a/tests/Australia/NorthernTerritory/NorthernTerritoryTest.php b/tests/Australia/NorthernTerritory/NorthernTerritoryTest.php index 4a777e8ae..746a52884 100644 --- a/tests/Australia/NorthernTerritory/NorthernTerritoryTest.php +++ b/tests/Australia/NorthernTerritory/NorthernTerritoryTest.php @@ -37,7 +37,7 @@ class NorthernTerritoryTest extends NorthernTerritoryBaseTestCase implements Pro */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/NorthernTerritory/PicnicDayTest.php b/tests/Australia/NorthernTerritory/PicnicDayTest.php index a3c1a69d9..40d76b23f 100644 --- a/tests/Australia/NorthernTerritory/PicnicDayTest.php +++ b/tests/Australia/NorthernTerritory/PicnicDayTest.php @@ -33,13 +33,12 @@ class PicnicDayTest extends NorthernTerritoryBaseTestCase implements HolidayTest /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-08-02'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Picnic Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/NorthernTerritory/QueensBirthdayTest.php b/tests/Australia/NorthernTerritory/QueensBirthdayTest.php index 01c246812..c9aa98c09 100644 --- a/tests/Australia/NorthernTerritory/QueensBirthdayTest.php +++ b/tests/Australia/NorthernTerritory/QueensBirthdayTest.php @@ -38,13 +38,12 @@ class QueensBirthdayTest extends NorthernTerritoryBaseTestCase implements Holida /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-06-14'], @@ -87,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Queen’s Birthday'] ); } @@ -102,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/Queensland/Brisbane/BrisbaneBaseTestCase.php b/tests/Australia/Queensland/Brisbane/BrisbaneBaseTestCase.php index 13641000d..aa5faa9bf 100644 --- a/tests/Australia/Queensland/Brisbane/BrisbaneBaseTestCase.php +++ b/tests/Australia/Queensland/Brisbane/BrisbaneBaseTestCase.php @@ -27,9 +27,11 @@ abstract class BrisbaneBaseTestCase extends QueenslandBaseTestCase { use YasumiBase; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/Brisbane'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia\Queensland\Brisbane'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/Brisbane'; } diff --git a/tests/Australia/Queensland/Brisbane/BrisbaneTest.php b/tests/Australia/Queensland/Brisbane/BrisbaneTest.php index c9e033488..a5dbea8a1 100644 --- a/tests/Australia/Queensland/Brisbane/BrisbaneTest.php +++ b/tests/Australia/Queensland/Brisbane/BrisbaneTest.php @@ -37,7 +37,7 @@ class BrisbaneTest extends BrisbaneBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/Queensland/Brisbane/PeoplesDayTest.php b/tests/Australia/Queensland/Brisbane/PeoplesDayTest.php index e6e1c9179..9f05a9bbf 100644 --- a/tests/Australia/Queensland/Brisbane/PeoplesDayTest.php +++ b/tests/Australia/Queensland/Brisbane/PeoplesDayTest.php @@ -33,13 +33,12 @@ class PeoplesDayTest extends BrisbaneBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-08-11'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Ekka People’s Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Queensland/LabourDayTest.php b/tests/Australia/Queensland/LabourDayTest.php index 45f5974a8..35c73e0b4 100644 --- a/tests/Australia/Queensland/LabourDayTest.php +++ b/tests/Australia/Queensland/LabourDayTest.php @@ -33,13 +33,12 @@ class LabourDayTest extends QueenslandBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-05-03'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Labour Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Queensland/QueensBirthdayTest.php b/tests/Australia/Queensland/QueensBirthdayTest.php index dfa064b75..8d3f14f67 100644 --- a/tests/Australia/Queensland/QueensBirthdayTest.php +++ b/tests/Australia/Queensland/QueensBirthdayTest.php @@ -38,13 +38,12 @@ class QueensBirthdayTest extends QueenslandBaseTestCase implements HolidayTestCa /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-06-14'], @@ -87,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Queen’s Birthday'] ); } @@ -102,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/Queensland/QueenslandBaseTestCase.php b/tests/Australia/Queensland/QueenslandBaseTestCase.php index d647387fd..d27d7965e 100644 --- a/tests/Australia/Queensland/QueenslandBaseTestCase.php +++ b/tests/Australia/Queensland/QueenslandBaseTestCase.php @@ -27,9 +27,11 @@ abstract class QueenslandBaseTestCase extends AustraliaBaseTestCase { use YasumiBase; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/Queensland'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia\Queensland'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/Queensland'; } diff --git a/tests/Australia/Queensland/QueenslandTest.php b/tests/Australia/Queensland/QueenslandTest.php index a3985bdc3..d291e2364 100644 --- a/tests/Australia/Queensland/QueenslandTest.php +++ b/tests/Australia/Queensland/QueenslandTest.php @@ -37,7 +37,7 @@ class QueenslandTest extends QueenslandBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/SouthAustralia/AdelaideCupDayTest.php b/tests/Australia/SouthAustralia/AdelaideCupDayTest.php index 5d94b72be..663482aa3 100644 --- a/tests/Australia/SouthAustralia/AdelaideCupDayTest.php +++ b/tests/Australia/SouthAustralia/AdelaideCupDayTest.php @@ -38,13 +38,12 @@ class AdelaideCupDayTest extends SouthAustraliaBaseTestCase implements HolidayTe /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2000, '2000-05-15'], @@ -97,7 +96,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Adelaide Cup'] ); } @@ -112,7 +111,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/SouthAustralia/ChristmasDayTest.php b/tests/Australia/SouthAustralia/ChristmasDayTest.php index 633038ed4..a103ff68d 100644 --- a/tests/Australia/SouthAustralia/ChristmasDayTest.php +++ b/tests/Australia/SouthAustralia/ChristmasDayTest.php @@ -34,14 +34,13 @@ class ChristmasDayTest extends SouthAustraliaBaseTestCase implements HolidayTest /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected, ?string $expectedExtra): void { $this->assertHoliday( @@ -71,7 +70,7 @@ public function testHoliday(int $year, string $expected, ?string $expectedExtra) * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-12-25', '2010-12-27'], @@ -98,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); $this->assertTranslatedHolidayName( @@ -116,7 +115,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); $this->assertHolidayType($this->region, self::HOLIDAY2, 2016, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/SouthAustralia/EasterSaturdayTest.php b/tests/Australia/SouthAustralia/EasterSaturdayTest.php index 821deffa1..3e9f934ba 100644 --- a/tests/Australia/SouthAustralia/EasterSaturdayTest.php +++ b/tests/Australia/SouthAustralia/EasterSaturdayTest.php @@ -33,13 +33,12 @@ class EasterSaturdayTest extends SouthAustraliaBaseTestCase implements HolidayTe /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, $this->timezone); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->sub(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Saturday'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/SouthAustralia/LabourDayTest.php b/tests/Australia/SouthAustralia/LabourDayTest.php index af871f15c..eb4207cde 100644 --- a/tests/Australia/SouthAustralia/LabourDayTest.php +++ b/tests/Australia/SouthAustralia/LabourDayTest.php @@ -33,13 +33,12 @@ class LabourDayTest extends SouthAustraliaBaseTestCase implements HolidayTestCas /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-10-04'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Labour Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/SouthAustralia/ProclamationDayTest.php b/tests/Australia/SouthAustralia/ProclamationDayTest.php index dd2280dbd..dddd26513 100644 --- a/tests/Australia/SouthAustralia/ProclamationDayTest.php +++ b/tests/Australia/SouthAustralia/ProclamationDayTest.php @@ -33,13 +33,12 @@ class ProclamationDayTest extends SouthAustraliaBaseTestCase implements HolidayT /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-12-28'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Proclamation Day'] ); } @@ -97,7 +96,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/SouthAustralia/QueensBirthdayTest.php b/tests/Australia/SouthAustralia/QueensBirthdayTest.php index 34776d959..f01e518ad 100644 --- a/tests/Australia/SouthAustralia/QueensBirthdayTest.php +++ b/tests/Australia/SouthAustralia/QueensBirthdayTest.php @@ -38,13 +38,12 @@ class QueensBirthdayTest extends SouthAustraliaBaseTestCase implements HolidayTe /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-06-14'], @@ -87,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Queen’s Birthday'] ); } @@ -102,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/SouthAustralia/SouthAustraliaBaseTestCase.php b/tests/Australia/SouthAustralia/SouthAustraliaBaseTestCase.php index df0b18fe3..e81e15457 100644 --- a/tests/Australia/SouthAustralia/SouthAustraliaBaseTestCase.php +++ b/tests/Australia/SouthAustralia/SouthAustraliaBaseTestCase.php @@ -27,9 +27,11 @@ abstract class SouthAustraliaBaseTestCase extends AustraliaBaseTestCase { use YasumiBase; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/South'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia\SouthAustralia'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/South'; } diff --git a/tests/Australia/SouthAustralia/SouthAustraliaTest.php b/tests/Australia/SouthAustralia/SouthAustraliaTest.php index 04178d4a0..030ba90bd 100644 --- a/tests/Australia/SouthAustralia/SouthAustraliaTest.php +++ b/tests/Australia/SouthAustralia/SouthAustraliaTest.php @@ -37,7 +37,7 @@ class SouthAustraliaTest extends SouthAustraliaBaseTestCase implements ProviderT */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1973); + $this->year = static::generateRandomYear(1973); } /** diff --git a/tests/Australia/Tasmania/CentralNorth/CentralNorthTest.php b/tests/Australia/Tasmania/CentralNorth/CentralNorthTest.php index 5471d655e..9c29788ae 100644 --- a/tests/Australia/Tasmania/CentralNorth/CentralNorthTest.php +++ b/tests/Australia/Tasmania/CentralNorth/CentralNorthTest.php @@ -37,7 +37,7 @@ class CentralNorthTest extends CentralNorthBaseTestCase implements ProviderTestC */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/Tasmania/CentralNorth/DevonportShowTest.php b/tests/Australia/Tasmania/CentralNorth/DevonportShowTest.php index 946db07f8..553fa2dac 100644 --- a/tests/Australia/Tasmania/CentralNorth/DevonportShowTest.php +++ b/tests/Australia/Tasmania/CentralNorth/DevonportShowTest.php @@ -33,13 +33,12 @@ class DevonportShowTest extends CentralNorthBaseTestCase implements HolidayTestC /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-11-26'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Devonport Show'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Tasmania/EightHourDayTest.php b/tests/Australia/Tasmania/EightHourDayTest.php index 8fd4ebed4..8e72b5bb9 100644 --- a/tests/Australia/Tasmania/EightHourDayTest.php +++ b/tests/Australia/Tasmania/EightHourDayTest.php @@ -33,13 +33,12 @@ class EightHourDayTest extends TasmaniaBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-03-08'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Eight Hour Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Tasmania/FlindersIsland/FlindersIslandShowTest.php b/tests/Australia/Tasmania/FlindersIsland/FlindersIslandShowTest.php index 646399386..fb3809c1c 100644 --- a/tests/Australia/Tasmania/FlindersIsland/FlindersIslandShowTest.php +++ b/tests/Australia/Tasmania/FlindersIsland/FlindersIslandShowTest.php @@ -33,13 +33,12 @@ class FlindersIslandShowTest extends FlindersIslandBaseTestCase implements Holid /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-10-15'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Flinders Island Show'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Tasmania/FlindersIsland/FlindersIslandTest.php b/tests/Australia/Tasmania/FlindersIsland/FlindersIslandTest.php index ec57b71eb..c62151902 100644 --- a/tests/Australia/Tasmania/FlindersIsland/FlindersIslandTest.php +++ b/tests/Australia/Tasmania/FlindersIsland/FlindersIslandTest.php @@ -37,7 +37,7 @@ class FlindersIslandTest extends FlindersIslandBaseTestCase implements ProviderT */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/Tasmania/KingIsland/KingIslandShowTest.php b/tests/Australia/Tasmania/KingIsland/KingIslandShowTest.php index 46899a343..324677b87 100644 --- a/tests/Australia/Tasmania/KingIsland/KingIslandShowTest.php +++ b/tests/Australia/Tasmania/KingIsland/KingIslandShowTest.php @@ -33,13 +33,12 @@ class KingIslandShowTest extends KingIslandBaseTestCase implements HolidayTestCa /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-03-02'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'King Island Show'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Tasmania/KingIsland/KingIslandTest.php b/tests/Australia/Tasmania/KingIsland/KingIslandTest.php index 61124226f..6d3dc16af 100644 --- a/tests/Australia/Tasmania/KingIsland/KingIslandTest.php +++ b/tests/Australia/Tasmania/KingIsland/KingIslandTest.php @@ -37,7 +37,7 @@ class KingIslandTest extends KingIslandBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/Tasmania/Northeast/LauncestonShowTest.php b/tests/Australia/Tasmania/Northeast/LauncestonShowTest.php index 939a5a8c8..5a4314960 100644 --- a/tests/Australia/Tasmania/Northeast/LauncestonShowTest.php +++ b/tests/Australia/Tasmania/Northeast/LauncestonShowTest.php @@ -33,13 +33,12 @@ class LauncestonShowTest extends NortheastBaseTestCase implements HolidayTestCas /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-10-07'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Royal Launceston Show'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Tasmania/Northeast/NortheastTest.php b/tests/Australia/Tasmania/Northeast/NortheastTest.php index a1b26cdfa..218199f4c 100644 --- a/tests/Australia/Tasmania/Northeast/NortheastTest.php +++ b/tests/Australia/Tasmania/Northeast/NortheastTest.php @@ -37,7 +37,7 @@ class NortheastTest extends NortheastBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/Tasmania/Northwest/BurnieShowTest.php b/tests/Australia/Tasmania/Northwest/BurnieShowTest.php index cf0f9b814..824ea622b 100644 --- a/tests/Australia/Tasmania/Northwest/BurnieShowTest.php +++ b/tests/Australia/Tasmania/Northwest/BurnieShowTest.php @@ -33,13 +33,12 @@ class BurnieShowTest extends NorthwestBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-10-01'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Burnie Show'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/AGFESTTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/AGFESTTest.php index 5d79bcc81..d863fd7d0 100644 --- a/tests/Australia/Tasmania/Northwest/CircularHead/AGFESTTest.php +++ b/tests/Australia/Tasmania/Northwest/CircularHead/AGFESTTest.php @@ -33,13 +33,12 @@ class AGFESTTest extends CircularHeadBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-05-07'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'AGFEST'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Tasmania/Northwest/CircularHead/CircularHeadTest.php b/tests/Australia/Tasmania/Northwest/CircularHead/CircularHeadTest.php index bf8c084be..62eabdf0a 100644 --- a/tests/Australia/Tasmania/Northwest/CircularHead/CircularHeadTest.php +++ b/tests/Australia/Tasmania/Northwest/CircularHead/CircularHeadTest.php @@ -36,7 +36,7 @@ class CircularHeadTest extends CircularHeadBaseTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/Tasmania/Northwest/NorthwestTest.php b/tests/Australia/Tasmania/Northwest/NorthwestTest.php index 98b258cf7..fb1de0c14 100644 --- a/tests/Australia/Tasmania/Northwest/NorthwestTest.php +++ b/tests/Australia/Tasmania/Northwest/NorthwestTest.php @@ -37,7 +37,7 @@ class NorthwestTest extends NorthwestBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/Tasmania/QueensBirthdayTest.php b/tests/Australia/Tasmania/QueensBirthdayTest.php index e3d002ed9..255009155 100644 --- a/tests/Australia/Tasmania/QueensBirthdayTest.php +++ b/tests/Australia/Tasmania/QueensBirthdayTest.php @@ -38,13 +38,12 @@ class QueensBirthdayTest extends TasmaniaBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-06-14'], @@ -87,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Queen’s Birthday'] ); } @@ -102,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/Tasmania/RecreationDayTest.php b/tests/Australia/Tasmania/RecreationDayTest.php index 3624d55f2..ab7a7b203 100644 --- a/tests/Australia/Tasmania/RecreationDayTest.php +++ b/tests/Australia/Tasmania/RecreationDayTest.php @@ -33,13 +33,12 @@ class RecreationDayTest extends TasmaniaBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-11-01'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Recreation Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Tasmania/South/HobartShowTest.php b/tests/Australia/Tasmania/South/HobartShowTest.php index 37c9817a5..78fca84e5 100644 --- a/tests/Australia/Tasmania/South/HobartShowTest.php +++ b/tests/Australia/Tasmania/South/HobartShowTest.php @@ -33,13 +33,12 @@ class HobartShowTest extends SouthBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-10-21'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Royal Hobart Show'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Tasmania/South/SouthTest.php b/tests/Australia/Tasmania/South/SouthTest.php index 3e60487e3..67c2b1fc0 100644 --- a/tests/Australia/Tasmania/South/SouthTest.php +++ b/tests/Australia/Tasmania/South/SouthTest.php @@ -37,7 +37,7 @@ class SouthTest extends SouthBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/Tasmania/South/Southeast/HobartRegattaTest.php b/tests/Australia/Tasmania/South/Southeast/HobartRegattaTest.php index 192ea84f8..1c3f960ad 100644 --- a/tests/Australia/Tasmania/South/Southeast/HobartRegattaTest.php +++ b/tests/Australia/Tasmania/South/Southeast/HobartRegattaTest.php @@ -33,13 +33,12 @@ class HobartRegattaTest extends SoutheastBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-02-08'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Royal Hobart Regatta'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Tasmania/South/Southeast/SoutheastBaseTestCase.php b/tests/Australia/Tasmania/South/Southeast/SoutheastBaseTestCase.php index 5d1ef5d9a..f70499b76 100644 --- a/tests/Australia/Tasmania/South/Southeast/SoutheastBaseTestCase.php +++ b/tests/Australia/Tasmania/South/Southeast/SoutheastBaseTestCase.php @@ -27,9 +27,11 @@ abstract class SoutheastBaseTestCase extends SouthBaseTestCase { use YasumiBase; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/Hobart'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia\Tasmania\South\Southeast'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/Hobart'; } diff --git a/tests/Australia/Tasmania/South/Southeast/SoutheastTest.php b/tests/Australia/Tasmania/South/Southeast/SoutheastTest.php index f550ed54c..8d4f0f59b 100644 --- a/tests/Australia/Tasmania/South/Southeast/SoutheastTest.php +++ b/tests/Australia/Tasmania/South/Southeast/SoutheastTest.php @@ -36,7 +36,7 @@ class SoutheastTest extends SoutheastBaseTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/Tasmania/TasmaniaBaseTestCase.php b/tests/Australia/Tasmania/TasmaniaBaseTestCase.php index b55075535..6bd6d3e77 100644 --- a/tests/Australia/Tasmania/TasmaniaBaseTestCase.php +++ b/tests/Australia/Tasmania/TasmaniaBaseTestCase.php @@ -27,9 +27,11 @@ abstract class TasmaniaBaseTestCase extends AustraliaBaseTestCase { use YasumiBase; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/Tasmania'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia\Tasmania'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/Tasmania'; } diff --git a/tests/Australia/Tasmania/TasmaniaTest.php b/tests/Australia/Tasmania/TasmaniaTest.php index 2e151fe7c..9f4347e08 100644 --- a/tests/Australia/Tasmania/TasmaniaTest.php +++ b/tests/Australia/Tasmania/TasmaniaTest.php @@ -37,7 +37,7 @@ class TasmaniaTest extends TasmaniaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Australia/Victoria/AFLGrandFinalFridayTest.php b/tests/Australia/Victoria/AFLGrandFinalFridayTest.php index 50ec78796..2b10ce91d 100644 --- a/tests/Australia/Victoria/AFLGrandFinalFridayTest.php +++ b/tests/Australia/Victoria/AFLGrandFinalFridayTest.php @@ -36,13 +36,12 @@ class AFLGrandFinalFridayTest extends VictoriaBaseTestCase implements HolidayTes /** * Tests AFL Grand Final Friday. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -63,7 +62,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LAST_KNOWN_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LAST_KNOWN_YEAR), [self::LOCALE => 'AFL Grand Final Friday'] ); } @@ -78,7 +77,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LAST_KNOWN_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LAST_KNOWN_YEAR), Holiday::TYPE_OFFICIAL ); } @@ -96,7 +95,7 @@ public function testNotHoliday(): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2015, '2015-10-02'], diff --git a/tests/Australia/Victoria/EasterSaturdayTest.php b/tests/Australia/Victoria/EasterSaturdayTest.php index 471dec174..75452f8b0 100644 --- a/tests/Australia/Victoria/EasterSaturdayTest.php +++ b/tests/Australia/Victoria/EasterSaturdayTest.php @@ -33,13 +33,12 @@ class EasterSaturdayTest extends VictoriaBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, $this->timezone); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->sub(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Saturday'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Victoria/EasterSundayTest.php b/tests/Australia/Victoria/EasterSundayTest.php index 2e7e62bfc..cee3a2da3 100644 --- a/tests/Australia/Victoria/EasterSundayTest.php +++ b/tests/Australia/Victoria/EasterSundayTest.php @@ -33,13 +33,12 @@ class EasterSundayTest extends VictoriaBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, $this->timezone); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $data[] = [$year, $date->format('Y-m-d')]; } @@ -81,7 +80,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Sunday'] ); } @@ -93,6 +92,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Victoria/LabourDayTest.php b/tests/Australia/Victoria/LabourDayTest.php index 0f7b7dfe3..9a3cb59ef 100644 --- a/tests/Australia/Victoria/LabourDayTest.php +++ b/tests/Australia/Victoria/LabourDayTest.php @@ -33,13 +33,12 @@ class LabourDayTest extends VictoriaBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-03-08'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Labour Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/Victoria/MelbourneCupDayTest.php b/tests/Australia/Victoria/MelbourneCupDayTest.php index 47b3e1f89..00457ef09 100644 --- a/tests/Australia/Victoria/MelbourneCupDayTest.php +++ b/tests/Australia/Victoria/MelbourneCupDayTest.php @@ -38,13 +38,12 @@ class MelbourneCupDayTest extends VictoriaBaseTestCase implements HolidayTestCas /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-11-02'], @@ -87,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Melbourne Cup'] ); } @@ -102,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/Victoria/QueensBirthdayTest.php b/tests/Australia/Victoria/QueensBirthdayTest.php index 576338ed9..b8a7cd95d 100644 --- a/tests/Australia/Victoria/QueensBirthdayTest.php +++ b/tests/Australia/Victoria/QueensBirthdayTest.php @@ -38,13 +38,12 @@ class QueensBirthdayTest extends VictoriaBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-06-14'], @@ -87,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Queen’s Birthday'] ); } @@ -102,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/Victoria/VictoriaBaseTestCase.php b/tests/Australia/Victoria/VictoriaBaseTestCase.php index e27c354f1..06796c0e4 100644 --- a/tests/Australia/Victoria/VictoriaBaseTestCase.php +++ b/tests/Australia/Victoria/VictoriaBaseTestCase.php @@ -27,9 +27,11 @@ abstract class VictoriaBaseTestCase extends AustraliaBaseTestCase { use YasumiBase; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/Victoria'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia\Victoria'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/Victoria'; } diff --git a/tests/Australia/Victoria/VictoriaTest.php b/tests/Australia/Victoria/VictoriaTest.php index 3bfd0e6b2..d3558e5fd 100644 --- a/tests/Australia/Victoria/VictoriaTest.php +++ b/tests/Australia/Victoria/VictoriaTest.php @@ -37,7 +37,7 @@ class VictoriaTest extends VictoriaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(2015, 2018); + $this->year = static::generateRandomYear(2015, 2018); } /** diff --git a/tests/Australia/WesternAustralia/LabourDayTest.php b/tests/Australia/WesternAustralia/LabourDayTest.php index dbfce69bd..d21949277 100644 --- a/tests/Australia/WesternAustralia/LabourDayTest.php +++ b/tests/Australia/WesternAustralia/LabourDayTest.php @@ -33,13 +33,12 @@ class LabourDayTest extends WesternAustraliaBaseTestCase implements HolidayTestC /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-03-01'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Labour Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/WesternAustralia/QueensBirthdayTest.php b/tests/Australia/WesternAustralia/QueensBirthdayTest.php index d83dcb462..0ea4590c5 100644 --- a/tests/Australia/WesternAustralia/QueensBirthdayTest.php +++ b/tests/Australia/WesternAustralia/QueensBirthdayTest.php @@ -38,13 +38,12 @@ class QueensBirthdayTest extends WesternAustraliaBaseTestCase implements Holiday /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-09-27'], @@ -87,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Queen’s Birthday'] ); } @@ -102,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( $this->region, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2100), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Australia/WesternAustralia/WesternAustraliaBaseTestCase.php b/tests/Australia/WesternAustralia/WesternAustraliaBaseTestCase.php index d1536af19..e57df32e4 100644 --- a/tests/Australia/WesternAustralia/WesternAustraliaBaseTestCase.php +++ b/tests/Australia/WesternAustralia/WesternAustraliaBaseTestCase.php @@ -27,9 +27,11 @@ abstract class WesternAustraliaBaseTestCase extends AustraliaBaseTestCase { use YasumiBase; + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Australia/West'; + /** Name of the region (e.g. country / state) to be tested. */ public string $region = 'Australia\WesternAustralia'; - /** Timezone in which this provider has holidays defined. */ public string $timezone = 'Australia/West'; } diff --git a/tests/Australia/WesternAustralia/WesternAustraliaDayTest.php b/tests/Australia/WesternAustralia/WesternAustraliaDayTest.php index fc0a2abce..663034d55 100644 --- a/tests/Australia/WesternAustralia/WesternAustraliaDayTest.php +++ b/tests/Australia/WesternAustralia/WesternAustraliaDayTest.php @@ -33,13 +33,12 @@ class WesternAustraliaDayTest extends WesternAustraliaBaseTestCase implements Ho /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -55,7 +54,7 @@ public function testHoliday(int $year, string $expected): void * * @return array list of test dates for the holiday defined in this test */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { return [ [2010, '2010-06-07'], @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( $this->region, self::HOLIDAY, - $this->generateRandomYear(1990), + static::generateRandomYear(1990), [self::LOCALE => 'Western Australia Day'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType($this->region, self::HOLIDAY, $this->generateRandomYear(1990), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType($this->region, self::HOLIDAY, static::generateRandomYear(1990), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Australia/WesternAustralia/WesternAustraliaTest.php b/tests/Australia/WesternAustralia/WesternAustraliaTest.php index a7c2ae96e..408b5e2ae 100644 --- a/tests/Australia/WesternAustralia/WesternAustraliaTest.php +++ b/tests/Australia/WesternAustralia/WesternAustraliaTest.php @@ -37,7 +37,7 @@ class WesternAustraliaTest extends WesternAustraliaBaseTestCase implements Provi */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1921); + $this->year = static::generateRandomYear(1921); } /** diff --git a/tests/Austria/AllSaintsDayTest.php b/tests/Austria/AllSaintsDayTest.php index 3b8f9e126..31efa3729 100644 --- a/tests/Austria/AllSaintsDayTest.php +++ b/tests/Austria/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends AustriaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/AscensionDayTest.php b/tests/Austria/AscensionDayTest.php index 2c518d3c1..671846291 100644 --- a/tests/Austria/AscensionDayTest.php +++ b/tests/Austria/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christi Himmelfahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/AssumptionOfMaryTest.php b/tests/Austria/AssumptionOfMaryTest.php index 4e3494c4e..e8eb50664 100644 --- a/tests/Austria/AssumptionOfMaryTest.php +++ b/tests/Austria/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends AustriaBaseTestCase implements HolidayTestCas /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Himmelfahrt'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/AustriaTest.php b/tests/Austria/AustriaTest.php index 32d774762..5b25263ab 100644 --- a/tests/Austria/AustriaTest.php +++ b/tests/Austria/AustriaTest.php @@ -37,7 +37,7 @@ class AustriaTest extends AustriaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1955); + $this->year = static::generateRandomYear(1955); } /** diff --git a/tests/Austria/Burgenland/BurgenlandTest.php b/tests/Austria/Burgenland/BurgenlandTest.php index 2ed5aff06..7e7a12e69 100644 --- a/tests/Austria/Burgenland/BurgenlandTest.php +++ b/tests/Austria/Burgenland/BurgenlandTest.php @@ -37,7 +37,7 @@ class BurgenlandTest extends BurgenlandBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1135); + $this->year = static::generateRandomYear(1135); } /** diff --git a/tests/Austria/Burgenland/stMartinsDayTest.php b/tests/Austria/Burgenland/stMartinsDayTest.php index 3c184f088..c93b483a0 100644 --- a/tests/Austria/Burgenland/stMartinsDayTest.php +++ b/tests/Austria/Burgenland/stMartinsDayTest.php @@ -33,11 +33,10 @@ class stMartinsDayTest extends BurgenlandBaseTestCase implements HolidayTestCase /** * Tests Saint Martins Day. * - * @dataProvider stMartinsDayDataProvider - * * @param int $year the year for which Saint Martins Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('stMartinsDayDataProvider')] public function teststMartinsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function teststMartinsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function stMartinsDayDataProvider(): array + public static function stMartinsDayDataProvider(): array { - return $this->generateRandomDates(11, 11, self::TIMEZONE); + return static::generateRandomDates(11, 11, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Martin'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/Carinthia/CarinthiaTest.php b/tests/Austria/Carinthia/CarinthiaTest.php index c4b66e1ab..693485608 100644 --- a/tests/Austria/Carinthia/CarinthiaTest.php +++ b/tests/Austria/Carinthia/CarinthiaTest.php @@ -37,7 +37,7 @@ class CarinthiaTest extends CarinthiaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1135); + $this->year = static::generateRandomYear(1135); } /** diff --git a/tests/Austria/Carinthia/PlebisciteDayTest.php b/tests/Austria/Carinthia/PlebisciteDayTest.php index bae4d0651..07fa083c2 100644 --- a/tests/Austria/Carinthia/PlebisciteDayTest.php +++ b/tests/Austria/Carinthia/PlebisciteDayTest.php @@ -38,11 +38,10 @@ class PlebisciteDayTest extends CarinthiaBaseTestCase implements HolidayTestCase /** * Tests Plebiscite Day. * - * @dataProvider PlebisciteDayDataProvider - * * @param int $year the year for which Plebiscite Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('PlebisciteDayDataProvider')] public function testPlebisciteDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testPlebisciteDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function PlebisciteDayDataProvider(): array + public static function PlebisciteDayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-10-10", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Tag der Volksabstimmung'] ); } @@ -103,6 +102,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/Carinthia/StJosephsDayTest.php b/tests/Austria/Carinthia/StJosephsDayTest.php index ac9f804f4..23c02299a 100644 --- a/tests/Austria/Carinthia/StJosephsDayTest.php +++ b/tests/Austria/Carinthia/StJosephsDayTest.php @@ -33,11 +33,10 @@ class StJosephsDayTest extends CarinthiaBaseTestCase implements HolidayTestCase /** * Tests St. Joseph's Day. * - * @dataProvider StJosephsDayDataProvider - * * @param int $year the year for which St. Joseph's Day needs to be tested. * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StJosephsDayDataProvider')] public function testStJosephsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testStJosephsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StJosephsDayDataProvider(): array + public static function StJosephsDayDataProvider(): array { - return $this->generateRandomDates(3, 19, self::TIMEZONE); + return static::generateRandomDates(3, 19, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Josephstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/ChristmasTest.php b/tests/Austria/ChristmasTest.php index 58bafb499..203bbb3c6 100644 --- a/tests/Austria/ChristmasTest.php +++ b/tests/Austria/ChristmasTest.php @@ -33,11 +33,10 @@ class ChristmasTest extends AustriaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christtag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/CorpusChristiTest.php b/tests/Austria/CorpusChristiTest.php index 85bbf10ec..953dbd30d 100644 --- a/tests/Austria/CorpusChristiTest.php +++ b/tests/Austria/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testHoliday(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/EasterMondayTest.php b/tests/Austria/EasterMondayTest.php index 42d39cb59..32b09bafe 100644 --- a/tests/Austria/EasterMondayTest.php +++ b/tests/Austria/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/EasterTest.php b/tests/Austria/EasterTest.php index 446bf8e7d..8aeb0be14 100644 --- a/tests/Austria/EasterTest.php +++ b/tests/Austria/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostersonntag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/EpiphanyTest.php b/tests/Austria/EpiphanyTest.php index d52b3782d..0483510a1 100644 --- a/tests/Austria/EpiphanyTest.php +++ b/tests/Austria/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends AustriaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Heilige Drei Könige'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/ImmaculateConceptionTest.php b/tests/Austria/ImmaculateConceptionTest.php index 5f3248c58..26b25228f 100644 --- a/tests/Austria/ImmaculateConceptionTest.php +++ b/tests/Austria/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends AustriaBaseTestCase implements HolidayTes /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Empfängnis'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/InternationalWorkersDayTest.php b/tests/Austria/InternationalWorkersDayTest.php index 69cf25c35..151a2dcd3 100644 --- a/tests/Austria/InternationalWorkersDayTest.php +++ b/tests/Austria/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends AustriaBaseTestCase implements Holiday /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Staatsfeiertag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/LowerAustria/LowerAustriaTest.php b/tests/Austria/LowerAustria/LowerAustriaTest.php index 77f4192b0..24c6eee58 100644 --- a/tests/Austria/LowerAustria/LowerAustriaTest.php +++ b/tests/Austria/LowerAustria/LowerAustriaTest.php @@ -37,7 +37,7 @@ class LowerAustriaTest extends LowerAustriaBaseTestCase implements ProviderTestC */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1135); + $this->year = static::generateRandomYear(1135); } /** diff --git a/tests/Austria/LowerAustria/StLeopoldsDayTest.php b/tests/Austria/LowerAustria/StLeopoldsDayTest.php index 1fa5f42ad..65b720857 100644 --- a/tests/Austria/LowerAustria/StLeopoldsDayTest.php +++ b/tests/Austria/LowerAustria/StLeopoldsDayTest.php @@ -38,11 +38,10 @@ class StLeopoldsDayTest extends LowerAustriaBaseTestCase implements HolidayTestC /** * Tests Saint Leopold's Day. * - * @dataProvider StLeopoldsDayDataProvider - * * @param int $year the year for which Saint Leopold's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StLeopoldsDayDataProvider')] public function testStLeopoldsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testStLeopoldsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StLeopoldsDayDataProvider(): array + public static function StLeopoldsDayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-11-15", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Leopold'] ); } @@ -103,6 +102,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/NationalDayTest.php b/tests/Austria/NationalDayTest.php index ae1b36ca5..dc64bc687 100644 --- a/tests/Austria/NationalDayTest.php +++ b/tests/Austria/NationalDayTest.php @@ -42,7 +42,7 @@ class NationalDayTest extends AustriaBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Nationalfeiertag'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Austria/NewYearsDayTest.php b/tests/Austria/NewYearsDayTest.php index 8f03e78e9..c24d02504 100644 --- a/tests/Austria/NewYearsDayTest.php +++ b/tests/Austria/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends AustriaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/PentecostMondayTest.php b/tests/Austria/PentecostMondayTest.php index de73afc47..5d18c864d 100644 --- a/tests/Austria/PentecostMondayTest.php +++ b/tests/Austria/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/PentecostTest.php b/tests/Austria/PentecostTest.php index 9445fac59..940097071 100644 --- a/tests/Austria/PentecostTest.php +++ b/tests/Austria/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingsten'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Austria/Salzburg/SalzburgTest.php b/tests/Austria/Salzburg/SalzburgTest.php index 07c029aee..d9e6e56f2 100644 --- a/tests/Austria/Salzburg/SalzburgTest.php +++ b/tests/Austria/Salzburg/SalzburgTest.php @@ -37,7 +37,7 @@ class SalzburgTest extends SalzburgBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1135); + $this->year = static::generateRandomYear(1135); } /** diff --git a/tests/Austria/Salzburg/StRupertsDayTest.php b/tests/Austria/Salzburg/StRupertsDayTest.php index 8f977e478..75574239e 100644 --- a/tests/Austria/Salzburg/StRupertsDayTest.php +++ b/tests/Austria/Salzburg/StRupertsDayTest.php @@ -33,11 +33,10 @@ class StRupertsDayTest extends SalzburgBaseTestCase implements HolidayTestCase /** * Tests Saint Rupert's Day. * - * @dataProvider StRupertsDayDataProvider - * * @param int $year the year for which Saint Rupert's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StRupertsDayDataProvider')] public function testStRupertsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testStRupertsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StRupertsDayDataProvider(): array + public static function StRupertsDayDataProvider(): array { - return $this->generateRandomDates(9, 24, self::TIMEZONE); + return static::generateRandomDates(9, 24, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Rupert'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/SecondChristmasDayTest.php b/tests/Austria/SecondChristmasDayTest.php index 492babfc7..43c30ed87 100644 --- a/tests/Austria/SecondChristmasDayTest.php +++ b/tests/Austria/SecondChristmasDayTest.php @@ -33,11 +33,10 @@ class SecondChristmasDayTest extends AustriaBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stefanitag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/Styria/StJosephsDayTest.php b/tests/Austria/Styria/StJosephsDayTest.php index 092e8054a..7d70cca41 100644 --- a/tests/Austria/Styria/StJosephsDayTest.php +++ b/tests/Austria/Styria/StJosephsDayTest.php @@ -33,11 +33,10 @@ class StJosephsDayTest extends StyriaBaseTestCase implements HolidayTestCase /** * Tests St. Joseph's Day. * - * @dataProvider StJosephsDayDataProvider - * * @param int $year the year for which St. Joseph's Day needs to be tested. * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StJosephsDayDataProvider')] public function testStJosephsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testStJosephsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StJosephsDayDataProvider(): array + public static function StJosephsDayDataProvider(): array { - return $this->generateRandomDates(3, 19, self::TIMEZONE); + return static::generateRandomDates(3, 19, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Josephstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/Styria/StyriaTest.php b/tests/Austria/Styria/StyriaTest.php index 91560a3c1..4dc14925e 100644 --- a/tests/Austria/Styria/StyriaTest.php +++ b/tests/Austria/Styria/StyriaTest.php @@ -37,7 +37,7 @@ class StyriaTest extends StyriaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1135); + $this->year = static::generateRandomYear(1135); } /** diff --git a/tests/Austria/Tyrol/StJosephsDayTest.php b/tests/Austria/Tyrol/StJosephsDayTest.php index 5153ad849..c16a3cc75 100644 --- a/tests/Austria/Tyrol/StJosephsDayTest.php +++ b/tests/Austria/Tyrol/StJosephsDayTest.php @@ -33,11 +33,10 @@ class StJosephsDayTest extends TyrolBaseTestCase implements HolidayTestCase /** * Tests St. Joseph's Day. * - * @dataProvider StJosephsDayDataProvider - * * @param int $year the year for which St. Joseph's Day needs to be tested. * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StJosephsDayDataProvider')] public function testStJosephsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testStJosephsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StJosephsDayDataProvider(): array + public static function StJosephsDayDataProvider(): array { - return $this->generateRandomDates(3, 19, self::TIMEZONE); + return static::generateRandomDates(3, 19, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Josephstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/Tyrol/TyrolTest.php b/tests/Austria/Tyrol/TyrolTest.php index 2d3a44925..db4d8818f 100644 --- a/tests/Austria/Tyrol/TyrolTest.php +++ b/tests/Austria/Tyrol/TyrolTest.php @@ -37,7 +37,7 @@ class TyrolTest extends TyrolBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1135); + $this->year = static::generateRandomYear(1135); } /** diff --git a/tests/Austria/UpperAustria/StFloriansDayTest.php b/tests/Austria/UpperAustria/StFloriansDayTest.php index a4f5af319..3ff4b5177 100644 --- a/tests/Austria/UpperAustria/StFloriansDayTest.php +++ b/tests/Austria/UpperAustria/StFloriansDayTest.php @@ -33,11 +33,10 @@ class StFloriansDayTest extends UpperAustriaBaseTestCase implements HolidayTestC /** * Tests Saint Florian's Day. * - * @dataProvider StFloriansDayDataProvider - * * @param int $year the year for which Saint Florian's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StFloriansDayDataProvider')] public function testStFloriansDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testStFloriansDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StFloriansDayDataProvider(): array + public static function StFloriansDayDataProvider(): array { - return $this->generateRandomDates(5, 4, self::TIMEZONE); + return static::generateRandomDates(5, 4, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Florian'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/UpperAustria/UpperAustriaTest.php b/tests/Austria/UpperAustria/UpperAustriaTest.php index eaceba604..36888f03e 100644 --- a/tests/Austria/UpperAustria/UpperAustriaTest.php +++ b/tests/Austria/UpperAustria/UpperAustriaTest.php @@ -37,7 +37,7 @@ class UpperAustriaTest extends UpperAustriaBaseTestCase implements ProviderTestC */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1135); + $this->year = static::generateRandomYear(1135); } /** diff --git a/tests/Austria/Vienna/StLeopoldsDayTest.php b/tests/Austria/Vienna/StLeopoldsDayTest.php index 7be9a2e5b..842a38842 100644 --- a/tests/Austria/Vienna/StLeopoldsDayTest.php +++ b/tests/Austria/Vienna/StLeopoldsDayTest.php @@ -38,11 +38,10 @@ class StLeopoldsDayTest extends ViennaBaseTestCase implements HolidayTestCase /** * Tests Saint Leopold's Day. * - * @dataProvider StLeopoldsDayDataProvider - * * @param int $year the year for which Saint Leopold's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StLeopoldsDayDataProvider')] public function testStLeopoldsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testStLeopoldsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StLeopoldsDayDataProvider(): array + public static function StLeopoldsDayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-11-15", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Leopold'] ); } @@ -103,6 +102,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/Vienna/ViennaTest.php b/tests/Austria/Vienna/ViennaTest.php index 9ed79a77f..2c5e8bf35 100644 --- a/tests/Austria/Vienna/ViennaTest.php +++ b/tests/Austria/Vienna/ViennaTest.php @@ -37,7 +37,7 @@ class ViennaTest extends ViennaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1135); + $this->year = static::generateRandomYear(1135); } /** diff --git a/tests/Austria/Vorarlberg/StJosephsDayTest.php b/tests/Austria/Vorarlberg/StJosephsDayTest.php index bf3758b13..850e6a464 100644 --- a/tests/Austria/Vorarlberg/StJosephsDayTest.php +++ b/tests/Austria/Vorarlberg/StJosephsDayTest.php @@ -33,11 +33,10 @@ class StJosephsDayTest extends VorarlbergBaseTestCase implements HolidayTestCase /** * Tests St. Joseph's Day. * - * @dataProvider StJosephsDayDataProvider - * * @param int $year the year for which St. Joseph's Day needs to be tested. * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StJosephsDayDataProvider')] public function testStJosephsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testStJosephsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StJosephsDayDataProvider(): array + public static function StJosephsDayDataProvider(): array { - return $this->generateRandomDates(3, 19, self::TIMEZONE); + return static::generateRandomDates(3, 19, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Josephstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Austria/Vorarlberg/VorarlbergTest.php b/tests/Austria/Vorarlberg/VorarlbergTest.php index dd7b4fa93..282073b10 100644 --- a/tests/Austria/Vorarlberg/VorarlbergTest.php +++ b/tests/Austria/Vorarlberg/VorarlbergTest.php @@ -37,7 +37,7 @@ class VorarlbergTest extends VorarlbergBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1135); + $this->year = static::generateRandomYear(1135); } /** diff --git a/tests/Base/HolidayOnFilterTest.php b/tests/Base/HolidayOnFilterTest.php index c952372a4..bebd43ee5 100644 --- a/tests/Base/HolidayOnFilterTest.php +++ b/tests/Base/HolidayOnFilterTest.php @@ -61,7 +61,7 @@ public function testHolidaysNotOnDate(): void $date ); - self::assertArrayNotHasKey($name, iterator_to_array($holidaysOnDate)); + self::assertArrayNotHasKey($name, iterator_to_array($holidaysOnDate), sprintf('`%s` should not exist for `%s`', $name, $date->format('Y-m-d'))); } } diff --git a/tests/Base/HolidayTest.php b/tests/Base/HolidayTest.php index 61ac6b185..57ae5e395 100644 --- a/tests/Base/HolidayTest.php +++ b/tests/Base/HolidayTest.php @@ -51,8 +51,6 @@ public function testHolidayIsJsonSerializable(): void $json = json_encode($holiday, JSON_THROW_ON_ERROR); $instance = json_decode($json, true, 512, JSON_THROW_ON_ERROR); - self::assertIsArray($instance); - self::assertNotNull($instance); self::assertArrayHasKey('shortName', $instance); } @@ -61,13 +59,11 @@ public function testHolidayWithDateTimeInterface(): void { // Assert with DateTime instance $holiday = new Holiday('testHoliday', [], new \DateTime(), 'en_US'); - self::assertNotNull($holiday); - self::assertInstanceOf(Holiday::class, $holiday); + self::assertInstanceOf(Holiday::class, $holiday, 'No holiday instance for date with DateTime instance'); // Assert with DateTimeImmutable instance $holiday = new Holiday('testHoliday', [], new \DateTimeImmutable(), 'en_US'); - self::assertNotNull($holiday); - self::assertInstanceOf(Holiday::class, $holiday); + self::assertInstanceOf(Holiday::class, $holiday, 'No holiday instance for date with DateTimeImmutable instance'); } /** @throws \Exception */ @@ -177,8 +173,6 @@ public function testHolidayGetNameWithGlobalTranslations(): void $holiday = new Holiday('newYearsDay', [], new \DateTime('2015-01-01'), $locale); $holiday->mergeGlobalTranslations($translationsStub); - self::assertNotNull($holiday->getName()); - self::assertIsString($holiday->getName()); self::assertEquals($translations[$locale], $holiday->getName()); } @@ -199,8 +193,6 @@ public function testHolidayGetNameWithGlobalParentLocaleTranslations(): void $holiday = new Holiday('newYearsDay', [], new \DateTime('2015-01-01'), $locale); $holiday->mergeGlobalTranslations($translationsStub); - self::assertNotNull($holiday->getName()); - self::assertIsString($holiday->getName()); self::assertEquals($translations['pl'], $holiday->getName()); } @@ -227,8 +219,6 @@ public function testHolidayGetNameWithGlobalAndCustomTranslations(): void ); $holiday->mergeGlobalTranslations($translationsStub); - self::assertNotNull($holiday->getName()); - self::assertIsString($holiday->getName()); self::assertEquals($customTranslation, $holiday->getName()); } @@ -255,8 +245,6 @@ public function testHolidayGetNameWithOverriddenGlobalTranslations(): void ); $holiday->mergeGlobalTranslations($translationsStub); - self::assertNotNull($holiday->getName()); - self::assertIsString($holiday->getName()); self::assertEquals($customTranslation, $holiday->getName()); } } diff --git a/tests/Base/SubstituteHolidayTest.php b/tests/Base/SubstituteHolidayTest.php index 742c92c20..39ebd0be4 100644 --- a/tests/Base/SubstituteHolidayTest.php +++ b/tests/Base/SubstituteHolidayTest.php @@ -72,8 +72,6 @@ public function testSubstituteHolidayIsJsonSerializable(): void $json = json_encode($substitute, JSON_THROW_ON_ERROR); $instance = json_decode($json, true, 512, JSON_THROW_ON_ERROR); - self::assertIsArray($instance); - self::assertNotNull($instance); self::assertArrayHasKey('shortName', $instance); self::assertArrayHasKey('substitutedHoliday', $instance); } @@ -84,13 +82,11 @@ public function testSubstituteHolidayWithDateTimeInterface(): void // Assert with DateTime instance $holiday = new Holiday('testHoliday', [], new \DateTime('2019-01-01'), 'en_US'); $substitute = new SubstituteHoliday($holiday, [], new \DateTime('2019-01-02'), 'en_US'); - self::assertNotNull($holiday); - self::assertInstanceOf(SubstituteHoliday::class, $substitute); + self::assertInstanceOf(SubstituteHoliday::class, $substitute, 'No substitute holiday instance on 2019-01-02'); // Assert with DateTimeImmutable instance $substitute = new SubstituteHoliday($holiday, [], new \DateTimeImmutable(), 'en_US'); - self::assertNotNull($holiday); - self::assertInstanceOf(SubstituteHoliday::class, $substitute); + self::assertInstanceOf(SubstituteHoliday::class, $substitute, 'No substitute holiday with DateTimeImmutable date'); } /** @throws \Exception */ @@ -114,15 +110,26 @@ public function testSubstituteHolidayGetNameWithCustomSubstituteTranslation(): v $substitute = new SubstituteHoliday($holiday, [$locale => $translation], new \DateTime('2019-01-02'), $locale); $translationsStub = $this->getMockBuilder(TranslationsInterface::class)->getMock(); + $matcher = self::exactly(3); $translationsStub - ->expects(self::exactly(3)) - ->method('getTranslations') - ->withConsecutive([self::equalTo('substituteHoliday')], [self::equalTo('substituteHoliday:testHoliday')], [self::equalTo('testHoliday')]) - ->willReturnOnConsecutiveCalls( - [$locale => 'foo'], - [$locale => 'foo'], - ['en' => 'foo'] - ); + ->expects($matcher) + ->method('getTranslations')->willReturnCallback(function (...$parameters) use ($matcher, $locale) { + if (1 === $matcher->numberOfInvocations()) { + self::assertSame('substituteHoliday', $parameters[0]); + + return [$locale => 'foo']; + } + if (2 === $matcher->numberOfInvocations()) { + self::assertSame('substituteHoliday:testHoliday', $parameters[0]); + + return [$locale => 'foo']; + } + if (3 === $matcher->numberOfInvocations()) { + self::assertSame('testHoliday', $parameters[0]); + + return ['en' => 'foo']; + } + }); $substitute->mergeGlobalTranslations($translationsStub); @@ -140,15 +147,26 @@ public function testSubstituteHolidayGetNameWithPatternFallback(): void $substitute = new SubstituteHoliday($holiday, [], new \DateTime('2019-01-02'), $locale); $translationsStub = $this->getMockBuilder(TranslationsInterface::class)->getMock(); + $matcher = self::exactly(3); $translationsStub - ->expects(self::exactly(3)) - ->method('getTranslations') - ->withConsecutive([self::equalTo('substituteHoliday')], [self::equalTo('substituteHoliday:testHoliday')], [self::equalTo('testHoliday')]) - ->willReturnOnConsecutiveCalls( - ['en' => '{0} obs'], - [], - [$locale => $translation] - ); + ->expects($matcher) + ->method('getTranslations')->willReturnCallback(function (...$parameters) use ($matcher, $locale, $translation) { + if (1 === $matcher->numberOfInvocations()) { + self::assertSame('substituteHoliday', $parameters[0]); + + return ['en' => '{0} obs']; + } + if (2 === $matcher->numberOfInvocations()) { + self::assertSame('substituteHoliday:testHoliday', $parameters[0]); + + return []; + } + if (3 === $matcher->numberOfInvocations()) { + self::assertSame('testHoliday', $parameters[0]); + + return [$locale => $translation]; + } + }); $substitute->mergeGlobalTranslations($translationsStub); @@ -166,15 +184,26 @@ public function testSubstituteHolidayGetNameWithGlobalSubstituteTranslation(): v $substitute = new SubstituteHoliday($holiday, [$locale => $translation], new \DateTime('2019-01-02'), $locale); $translationsStub = $this->getMockBuilder(TranslationsInterface::class)->getMock(); + $matcher = self::exactly(3); $translationsStub - ->expects(self::exactly(3)) - ->method('getTranslations') - ->withConsecutive([self::equalTo('substituteHoliday')], [self::equalTo('substituteHoliday:testHoliday')], [self::equalTo('testHoliday')]) - ->willReturnOnConsecutiveCalls( - [$locale => '{0} observed'], - [$locale => $translation], - [$locale => 'foo'], - ); + ->expects($matcher) + ->method('getTranslations')->willReturnCallback(function (...$parameters) use ($matcher, $locale, $translation) { + if (1 === $matcher->numberOfInvocations()) { + self::assertSame('substituteHoliday', $parameters[0]); + + return [$locale => '{0} observed']; + } + if (2 === $matcher->numberOfInvocations()) { + self::assertSame('substituteHoliday:testHoliday', $parameters[0]); + + return [$locale => $translation]; + } + if (3 === $matcher->numberOfInvocations()) { + self::assertSame('testHoliday', $parameters[0]); + + return [$locale => 'foo']; + } + }); $substitute->mergeGlobalTranslations($translationsStub); @@ -192,15 +221,26 @@ public function testSubstituteHolidayGetNameWithSubstitutedTranslation(): void $substitute = new SubstituteHoliday($holiday, [], new \DateTime('2019-01-02'), $locale); $translationsStub = $this->getMockBuilder(TranslationsInterface::class)->getMock(); + $matcher = self::exactly(3); $translationsStub - ->expects(self::exactly(3)) - ->method('getTranslations') - ->withConsecutive([self::equalTo('substituteHoliday')], [self::equalTo('substituteHoliday:testHoliday')], [self::equalTo('testHoliday')]) - ->willReturnOnConsecutiveCalls( - [$locale => '{0} observed'], - [], - [$locale => $translation], - ); + ->expects($matcher) + ->method('getTranslations')->willReturnCallback(function (...$parameters) use ($matcher, $locale, $translation) { + if (1 === $matcher->numberOfInvocations()) { + self::assertSame('substituteHoliday', $parameters[0]); + + return [$locale => '{0} observed']; + } + if (2 === $matcher->numberOfInvocations()) { + self::assertSame('substituteHoliday:testHoliday', $parameters[0]); + + return []; + } + if (3 === $matcher->numberOfInvocations()) { + self::assertSame('testHoliday', $parameters[0]); + + return [$locale => $translation]; + } + }); $substitute->mergeGlobalTranslations($translationsStub); diff --git a/tests/Base/TranslationsTest.php b/tests/Base/TranslationsTest.php index 7173c0b2b..e45c46cfd 100644 --- a/tests/Base/TranslationsTest.php +++ b/tests/Base/TranslationsTest.php @@ -43,12 +43,7 @@ public function testAddTranslation(): void $translations->addTranslation($key, $locale, $translation); - self::assertNotNull($translations->getTranslations($key)); - self::assertNotEmpty($translations->getTranslations($key)); self::assertEquals([$locale => $translation], $translations->getTranslations($key)); - - self::assertNotNull($translations->getTranslation($key, $locale)); - self::assertIsString($translations->getTranslation($key, $locale)); self::assertEquals($translation, $translations->getTranslation($key, $locale)); } @@ -62,12 +57,7 @@ public function testAddMultipleTranslations(): void $translations->addTranslation($firstIdentifier, $firstLocale, $firstTranslation); - self::assertNotNull($translations->getTranslations($firstIdentifier)); - self::assertNotEmpty($translations->getTranslations($firstIdentifier)); self::assertEquals([$firstLocale => $firstTranslation], $translations->getTranslations($firstIdentifier)); - - self::assertNotNull($translations->getTranslation($firstIdentifier, $firstLocale)); - self::assertIsString($translations->getTranslation($firstIdentifier, $firstLocale)); self::assertEquals($firstTranslation, $translations->getTranslation($firstIdentifier, $firstLocale)); $secondLocale = 'nl_NL'; @@ -76,12 +66,7 @@ public function testAddMultipleTranslations(): void $translations->addTranslation($secondIdentifier, $secondLocale, $secondTranslation); - self::assertNotNull($translations->getTranslations($secondIdentifier)); - self::assertNotEmpty($translations->getTranslations($secondIdentifier)); self::assertEquals([$secondLocale => $secondTranslation], $translations->getTranslations($secondIdentifier)); - - self::assertNotNull($translations->getTranslation($secondIdentifier, $secondLocale)); - self::assertIsString($translations->getTranslation($secondIdentifier, $secondLocale)); self::assertEquals($secondTranslation, $translations->getTranslation($secondIdentifier, $secondLocale)); $thirdLocale = 'en_US'; @@ -90,15 +75,10 @@ public function testAddMultipleTranslations(): void $translations->addTranslation($thirdIdentifier, $thirdLocale, $thirdTranslation); - self::assertNotNull($translations->getTranslations($thirdIdentifier)); - self::assertNotEmpty($translations->getTranslations($thirdIdentifier)); self::assertEquals( [$thirdLocale => $thirdTranslation, $secondLocale => $secondTranslation], $translations->getTranslations($thirdIdentifier) ); - - self::assertNotNull($translations->getTranslation($thirdIdentifier, $thirdLocale)); - self::assertIsString($translations->getTranslation($thirdIdentifier, $thirdLocale)); self::assertEquals($thirdTranslation, $translations->getTranslation($thirdIdentifier, $thirdLocale)); } @@ -166,9 +146,6 @@ public function testLoadingTranslationsFromDirectory(): void $locale = 'en_US'; $translation = 'New Year’s Day'; - self::assertNotNull($translations->getTranslations($key)); - self::assertNotEmpty($translations->getTranslations($key)); - self::assertIsString($translations->getTranslation($key, $locale)); self::assertEquals($translation, $translations->getTranslation($key, $locale)); } @@ -257,17 +234,11 @@ public function testLoadingMultipleTranslationsFromDirectory(): void $locale = 'en_US'; $translation = 'New Year’s Day'; - self::assertNotNull($translations->getTranslations($firstIdentifier)); - self::assertNotEmpty($translations->getTranslations($firstIdentifier)); - self::assertIsString($translations->getTranslation($firstIdentifier, $locale)); self::assertEquals($translation, $translations->getTranslation($firstIdentifier, $locale)); $locale = 'nl_NL'; $translation = 'Eerste Paasdag'; - self::assertNotNull($translations->getTranslations($secondIdentifier)); - self::assertNotEmpty($translations->getTranslations($secondIdentifier)); - self::assertIsString($translations->getTranslation($secondIdentifier, $locale)); self::assertEquals($translation, $translations->getTranslation($secondIdentifier, $locale)); } } diff --git a/tests/Base/TypographyTest.php b/tests/Base/TypographyTest.php index 6a310d399..a233b3f20 100644 --- a/tests/Base/TypographyTest.php +++ b/tests/Base/TypographyTest.php @@ -35,13 +35,12 @@ class TypographyTest extends TestCase use YasumiBase; /** - * @dataProvider translationProvider - * * @param string $name The localized holiday name * @param string $class The provider * @param string $key The holiday key * @param string $locale The locale */ + #[\PHPUnit\Framework\Attributes\DataProvider('translationProvider')] public function testTranslations(string $name, string $class, string $key, string $locale): void { self::assertStringNotContainsString("'", $name, 'Translation contains typewriter apostrophe'); @@ -56,14 +55,14 @@ public function testTranslations(string $name, string $class, string $key, strin * @throws \ReflectionException * @throws \Exception */ - public function translationProvider(): array + public static function translationProvider(): array { $classes = Yasumi::getProviders(); $tests = []; foreach ($classes as $class) { - $provider = Yasumi::create($class, $this->generateRandomYear()); + $provider = Yasumi::create($class, static::generateRandomYear()); foreach ($provider->getHolidays() as $holiday) { foreach ($holiday->translations as $locale => $name) { diff --git a/tests/Base/WeekendTest.php b/tests/Base/WeekendTest.php index 7cafc4f0d..5acadfd24 100644 --- a/tests/Base/WeekendTest.php +++ b/tests/Base/WeekendTest.php @@ -35,15 +35,13 @@ class WeekendTest extends TestCase * Note: this test uses Belgium as a representative country for the global, common weekend definition. * Tests for countries that deviate from the global definition will be added as soon as their respective * Holiday Provider is created. - * - * @dataProvider dataProviderWeekendDays */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderWeekendDays')] public function testWeekendDay(\DateTimeImmutable $date): void { $yasumiProvider = Yasumi::create(self::HOLIDAY_PROVIDER, (int) $date->format('Y')); $isWeekendDay = $yasumiProvider->isWeekendDay($date); - self::assertIsBool($isWeekendDay); self::assertTrue($isWeekendDay); } @@ -52,7 +50,7 @@ public function testWeekendDay(\DateTimeImmutable $date): void * * @throws \Exception */ - public function dataProviderWeekendDays(): array + public static function dataProviderWeekendDays(): array { return [ [ @@ -77,15 +75,13 @@ public function dataProviderWeekendDays(): array * Note: this test uses Belgium as a representative country for the global, common weekend definition. * Tests for countries that deviate from the global definition will be added as soon as their respective * Holiday Provider is created. - * - * @dataProvider dataProviderNonWeekendDays */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderNonWeekendDays')] public function testNonWeekendDay(\DateTimeImmutable $date): void { $yasumiProvider = Yasumi::create(self::HOLIDAY_PROVIDER, (int) $date->format('Y')); $isWeekendDay = $yasumiProvider->isWeekendDay($date); - self::assertIsBool($isWeekendDay); self::assertFalse($isWeekendDay); } @@ -94,7 +90,7 @@ public function testNonWeekendDay(\DateTimeImmutable $date): void * * @throws \Exception */ - public function dataProviderNonWeekendDays(): array + public static function dataProviderNonWeekendDays(): array { return [ [ diff --git a/tests/Base/YasumiTest.php b/tests/Base/YasumiTest.php index 472298346..f39b35231 100644 --- a/tests/Base/YasumiTest.php +++ b/tests/Base/YasumiTest.php @@ -61,6 +61,14 @@ public function testCreateWithAbstractClassProvider(): void Yasumi::create('AbstractProvider'); } + public function testCreateWithClassNotImplementingProviderInterface(): void + { + $this->expectException(ProviderNotFoundException::class); + + $class = new class {}; + Yasumi::create($class::class, self::YEAR_LOWER_BOUND); + } + public function testCreateWithAbstractExtension(): void { $class = YasumiExternalProvider::class; @@ -68,7 +76,7 @@ public function testCreateWithAbstractExtension(): void $class, self::numberBetween(self::YEAR_LOWER_BOUND, self::YEAR_UPPER_BOUND) ); - self::assertInstanceOf(YasumiExternalProvider::class, $instance); + self::assertInstanceOf(YasumiExternalProvider::class, $instance, 'No holiday instance for external holiday provider'); } public function testCreateWithInvalidLocale(): void @@ -199,10 +207,8 @@ public function testWhenIsWithBlankKey(): void public function testGetHolidayWithBlankKey(): void { - $this->expectException(\InvalidArgumentException::class); - $holidays = Yasumi::create('Netherlands', 1999); - $holidays->getHoliday(''); + self::assertNull($holidays->getHoliday('')); } public function testWhatWeekDayIs(): void @@ -275,16 +281,10 @@ public function testIsHoliday(): void $date = $year . '-08-15'; // Assertion using a DateTime instance - $isHoliday = Yasumi::create($provider, $year)->isHoliday(new \DateTime($date)); - self::assertIsBool($isHoliday); - self::assertTrue($isHoliday); + self::assertTrue(Yasumi::create($provider, $year)->isHoliday(new \DateTime($date)), sprintf('Date `%s` not recognised as holiday', $date)); // Assertion using a DateTimeImmutable instance - $isHoliday = Yasumi::create($provider, $year)->isHoliday(new \DateTimeImmutable($date)); - self::assertIsBool($isHoliday); - self::assertTrue($isHoliday); - - unset($isHoliday); + self::assertTrue(Yasumi::create($provider, $year)->isHoliday(new \DateTimeImmutable($date)), sprintf('Immutable Date `%s` not recognised as holiday', $date)); } /** @@ -303,12 +303,10 @@ public function testIsNotHoliday(): void // Assertion using a DateTime instance $isHoliday = Yasumi::create($provider, $year)->isHoliday(new \DateTime($date)); - self::assertIsBool($isHoliday); self::assertFalse($isHoliday); // Assertion using a DateTimeImmutable instance $isHoliday = Yasumi::create($provider, $year)->isHoliday(new \DateTimeImmutable($date)); - self::assertIsBool($isHoliday); self::assertFalse($isHoliday); unset($isHoliday); @@ -330,12 +328,10 @@ public function testIsWorkingDay(): void // Assertion using a DateTime instance $isWorkingDay = Yasumi::create($provider, $year)->isWorkingDay(new \DateTime($date)); - self::assertIsBool($isWorkingDay); self::assertTrue($isWorkingDay); // Assertion using a DateTimeImmutable instance $isWorkingDay = Yasumi::create($provider, $year)->isWorkingDay(new \DateTimeImmutable($date)); - self::assertIsBool($isWorkingDay); self::assertTrue($isWorkingDay); unset($isWorkingDay); @@ -357,12 +353,10 @@ public function testIsNotWorkingDay(): void // Assertion using a DateTime instance $isNotWorkingDay = Yasumi::create($provider, $year)->isWorkingDay(new \DateTime($date)); - self::assertIsBool($isNotWorkingDay); self::assertFalse($isNotWorkingDay); // Assertion using a DateTimeImmutable instance $isNotWorkingDay = Yasumi::create($provider, $year)->isWorkingDay(new \DateTimeImmutable($date)); - self::assertIsBool($isNotWorkingDay); self::assertFalse($isNotWorkingDay); unset($isNotWorkingDay); @@ -412,6 +406,14 @@ public function testRemoveHoliday(): void self::assertArrayNotHasKey('octoberHoliday', $holidaysAfterRemoval); } + public function testRemoveHolidayWithBlankKey(): void + { + $this->expectException(\InvalidArgumentException::class); + + $holidays = Yasumi::create('Netherlands', 1999); + $holidays->removeHoliday(''); + } + /** * Tests that a holiday provider instance can be created by using the ISO3166-2 * country/region code. (Using the Yasumi::createByISO3166_2 method). diff --git a/tests/Base/YasumiWorkdayTest.php b/tests/Base/YasumiWorkdayTest.php index 3795c413b..90bd91ec8 100644 --- a/tests/Base/YasumiWorkdayTest.php +++ b/tests/Base/YasumiWorkdayTest.php @@ -41,14 +41,14 @@ public function testNextWorkingDay(): void $startDate = new \DateTime($date, new \DateTimeZone($timezone)); $nextWorkingDay = Yasumi::nextWorkingDay($provider, $startDate); - self::assertInstanceOf(\DateTimeImmutable::class, $nextWorkingDay); + self::assertInstanceOf(\DateTimeImmutable::class, $nextWorkingDay, sprintf('No holiday instance for the next working day of `%s`', $date)); self::assertEquals($expectedDate, $nextWorkingDay->format(self::FORMAT_DATE)); // Assertion using a DateTimeImmutable instance $startDate = new \DateTimeImmutable($date, new \DateTimeZone($timezone)); $nextWorkingDay = Yasumi::nextWorkingDay($provider, $startDate); - self::assertInstanceOf(\DateTimeImmutable::class, $nextWorkingDay); + self::assertInstanceOf(\DateTimeImmutable::class, $nextWorkingDay, sprintf('No holiday instance for the next working day of `%s`', $date)); self::assertEquals($expectedDate, $nextWorkingDay->format(self::FORMAT_DATE)); } @@ -69,14 +69,14 @@ public function testPreviousWorkingDay(): void $startDate = new \DateTime($date, new \DateTimeZone($timezone)); $previousWorkingDay = Yasumi::prevWorkingDay($provider, $startDate); - self::assertInstanceOf(\DateTimeImmutable::class, $previousWorkingDay); + self::assertInstanceOf(\DateTimeImmutable::class, $previousWorkingDay, sprintf('No holiday instance for the previous working day of `%s`', $date)); self::assertEquals($expectedDate, $previousWorkingDay->format(self::FORMAT_DATE)); // Assertion using a DateTimeImmutable instance $startDate = new \DateTimeImmutable($date, new \DateTimeZone($timezone)); $previousWorkingDay = Yasumi::prevWorkingDay($provider, $startDate); - self::assertInstanceOf(\DateTimeImmutable::class, $previousWorkingDay); + self::assertInstanceOf(\DateTimeImmutable::class, $previousWorkingDay, sprintf('No holiday instance for the previous working day of `%s`', $date)); self::assertEquals($expectedDate, $previousWorkingDay->format(self::FORMAT_DATE)); } @@ -136,10 +136,9 @@ public function testYearBoundary(): void /** * Tests when the next working day happens to be in the next year. * - * @dataProvider dataProviderWorkDayNextYear - * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderWorkDayNextYear')] public function testWorkDayIsNextYear(string $start, int $workdays, string $expectedNext): void { $provider = 'USA'; @@ -153,7 +152,7 @@ public function testWorkDayIsNextYear(string $start, int $workdays, string $expe /** * @return array list of test dates that are considered working days the next year */ - public function dataProviderWorkDayNextYear(): array + public static function dataProviderWorkDayNextYear(): array { return [ [ @@ -172,10 +171,9 @@ public function dataProviderWorkDayNextYear(): array /** * Tests when the previous working day happens to be in the previous year. * - * @dataProvider dataProviderWorkDayPreviousYear - * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataProviderWorkDayPreviousYear')] public function testWorkDayIsPreviousYear(string $start, int $workdays, string $expectedNext): void { $provider = 'USA'; @@ -189,7 +187,7 @@ public function testWorkDayIsPreviousYear(string $start, int $workdays, string $ /** * @return array list of test dates that are considered working days the previous year */ - public function dataProviderWorkDayPreviousYear(): array + public static function dataProviderWorkDayPreviousYear(): array { return [ [ diff --git a/tests/Belgium/AllSaintsDayTest.php b/tests/Belgium/AllSaintsDayTest.php index 96487b3ee..bf6fc119b 100644 --- a/tests/Belgium/AllSaintsDayTest.php +++ b/tests/Belgium/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends BelgiumBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/ArmisticeDayTest.php b/tests/Belgium/ArmisticeDayTest.php index 29dfaa4db..301506fcd 100644 --- a/tests/Belgium/ArmisticeDayTest.php +++ b/tests/Belgium/ArmisticeDayTest.php @@ -33,11 +33,10 @@ class ArmisticeDayTest extends BelgiumBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 11, self::TIMEZONE); + return static::generateRandomDates(11, 11, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Wapenstilstand'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/AscensionDayTest.php b/tests/Belgium/AscensionDayTest.php index d6ddd9f68..6e6fa0354 100644 --- a/tests/Belgium/AscensionDayTest.php +++ b/tests/Belgium/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Hemelvaart'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/AssumptionOfMaryTest.php b/tests/Belgium/AssumptionOfMaryTest.php index bc77ee647..7cb6538a1 100644 --- a/tests/Belgium/AssumptionOfMaryTest.php +++ b/tests/Belgium/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends BelgiumBaseTestCase implements HolidayTestCas /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Onze Lieve Vrouw hemelvaart'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/BelgiumTest.php b/tests/Belgium/BelgiumTest.php index 53a81cf20..259e032f7 100644 --- a/tests/Belgium/BelgiumTest.php +++ b/tests/Belgium/BelgiumTest.php @@ -36,7 +36,7 @@ class BelgiumTest extends BelgiumBaseTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(); + $this->year = static::generateRandomYear(); } /** diff --git a/tests/Belgium/ChristmasTest.php b/tests/Belgium/ChristmasTest.php index 22c7c44da..97f653b9d 100644 --- a/tests/Belgium/ChristmasTest.php +++ b/tests/Belgium/ChristmasTest.php @@ -33,11 +33,10 @@ class ChristmasTest extends BelgiumBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Kerstmis'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/EasterMondayTest.php b/tests/Belgium/EasterMondayTest.php index c8ee54c00..073e5ff7d 100644 --- a/tests/Belgium/EasterMondayTest.php +++ b/tests/Belgium/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'paasmaandag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/EasterTest.php b/tests/Belgium/EasterTest.php index 208d50309..fc14e1f5f 100644 --- a/tests/Belgium/EasterTest.php +++ b/tests/Belgium/EasterTest.php @@ -63,7 +63,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'eerste paasdag'] ); } @@ -75,6 +75,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/InternationalWorkersDayTest.php b/tests/Belgium/InternationalWorkersDayTest.php index d2ea808ac..6eedf9c31 100644 --- a/tests/Belgium/InternationalWorkersDayTest.php +++ b/tests/Belgium/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends BelgiumBaseTestCase implements Holiday /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Dag van de arbeid'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/NationalDayTest.php b/tests/Belgium/NationalDayTest.php index dad4901b0..b8dd5583a 100644 --- a/tests/Belgium/NationalDayTest.php +++ b/tests/Belgium/NationalDayTest.php @@ -33,11 +33,10 @@ class NationalDayTest extends BelgiumBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(7, 21, self::TIMEZONE); + return static::generateRandomDates(7, 21, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'nationale feestdag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/NewYearsDayTest.php b/tests/Belgium/NewYearsDayTest.php index f95a95bab..addb79aef 100644 --- a/tests/Belgium/NewYearsDayTest.php +++ b/tests/Belgium/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends BelgiumBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nieuwjaar'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/PentecostTest.php b/tests/Belgium/PentecostTest.php index 9da1d78c0..5bbd7bef6 100644 --- a/tests/Belgium/PentecostTest.php +++ b/tests/Belgium/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'eerste pinksterdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Belgium/pentecostMondayTest.php b/tests/Belgium/pentecostMondayTest.php index 6ab40df99..75eb16a64 100644 --- a/tests/Belgium/pentecostMondayTest.php +++ b/tests/Belgium/pentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'pinkstermaandag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Bosnia/BosniaTest.php b/tests/Bosnia/BosniaTest.php index a6f2f1985..361e19c00 100644 --- a/tests/Bosnia/BosniaTest.php +++ b/tests/Bosnia/BosniaTest.php @@ -37,7 +37,7 @@ class BosniaTest extends BosniaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1992); + $this->year = static::generateRandomYear(1992); } /** diff --git a/tests/Bosnia/ChristmasDayTest.php b/tests/Bosnia/ChristmasDayTest.php index f1400b8d2..c5fb8241b 100644 --- a/tests/Bosnia/ChristmasDayTest.php +++ b/tests/Bosnia/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends BosniaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Božić'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Bosnia/DayAfterNewYearsDay.php b/tests/Bosnia/DayAfterNewYearsDay.php index d13cff499..b1a580e3a 100644 --- a/tests/Bosnia/DayAfterNewYearsDay.php +++ b/tests/Bosnia/DayAfterNewYearsDay.php @@ -30,14 +30,18 @@ class DayAfterNewYearsDay extends BosniaBaseTestCase implements HolidayTestCase */ public const HOLIDAY = 'dayAfterNewYearsDay'; + public function __construct() + { + parent::__construct(static::class); + } + /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +54,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 2, self::TIMEZONE); + return static::generateRandomDates(1, 2, self::TIMEZONE); } /** @@ -65,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nova godina - drugi dan'] ); } @@ -77,6 +81,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Bosnia/EasterTest.php b/tests/Bosnia/EasterTest.php index 9cc887591..1c3defa82 100644 --- a/tests/Bosnia/EasterTest.php +++ b/tests/Bosnia/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Uskrs'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Bosnia/IndependenceDayTest.php b/tests/Bosnia/IndependenceDayTest.php index d105e5d09..a03425c81 100644 --- a/tests/Bosnia/IndependenceDayTest.php +++ b/tests/Bosnia/IndependenceDayTest.php @@ -42,7 +42,7 @@ class IndependenceDayTest extends BosniaBaseTestCase implements HolidayTestCase */ public function testIndependenceDayOnAfter1992(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testIndependenceDayBefore1992(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dan Nezavisnosti'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bosnia/InternationalWorkersDayTest.php b/tests/Bosnia/InternationalWorkersDayTest.php index 78cb3f137..b48bca6bd 100644 --- a/tests/Bosnia/InternationalWorkersDayTest.php +++ b/tests/Bosnia/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends BosniaBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Praznik rada'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Bosnia/NewYearsDayTest.php b/tests/Bosnia/NewYearsDayTest.php index eb3f3aa9e..a113dab7b 100644 --- a/tests/Bosnia/NewYearsDayTest.php +++ b/tests/Bosnia/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends BosniaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nova godina'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Bosnia/OrthodoxChristmasDay.php b/tests/Bosnia/OrthodoxChristmasDay.php index e94f98632..224b08ba5 100644 --- a/tests/Bosnia/OrthodoxChristmasDay.php +++ b/tests/Bosnia/OrthodoxChristmasDay.php @@ -30,19 +30,22 @@ class OrthodoxChristmasDay extends BosniaBaseTestCase implements HolidayTestCase */ public const HOLIDAY = 'orthodoxChristmasDay'; + public function __construct() + { + parent::__construct(static::class); + } + /** * @return array list of test dates for the holiday defined in this test * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 7, self::TIMEZONE); + return static::generateRandomDates(1, 7, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -56,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pravoslavni Božić'] ); } @@ -66,6 +69,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Bosnia/SecondLabourDay.php b/tests/Bosnia/SecondLabourDay.php index ec362cf78..92f94366c 100644 --- a/tests/Bosnia/SecondLabourDay.php +++ b/tests/Bosnia/SecondLabourDay.php @@ -30,14 +30,18 @@ class SecondLabourDay extends BosniaBaseTestCase implements HolidayTestCase */ public const HOLIDAY = 'secondLabourDay'; + public function __construct() + { + parent::__construct(static::class); + } + /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +57,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Praznik rada - drugi dan'] ); } @@ -65,7 +69,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +79,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 2, self::TIMEZONE); + return static::generateRandomDates(5, 2, self::TIMEZONE); } } diff --git a/tests/Bosnia/StatehoodDayTest.php b/tests/Bosnia/StatehoodDayTest.php index 57429b018..60c9228b3 100644 --- a/tests/Bosnia/StatehoodDayTest.php +++ b/tests/Bosnia/StatehoodDayTest.php @@ -42,7 +42,7 @@ class StatehoodDayTest extends BosniaBaseTestCase implements HolidayTestCase */ public function testStatehoodDayOnAfter1943(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testStatehoodDayBefore1943(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dan državnosti'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Brazil/AllSoulsDayTest.php b/tests/Brazil/AllSoulsDayTest.php index a30efb795..8e3fb4025 100644 --- a/tests/Brazil/AllSoulsDayTest.php +++ b/tests/Brazil/AllSoulsDayTest.php @@ -42,7 +42,7 @@ class AllSoulsDayTest extends BrazilBaseTestCase implements HolidayTestCase */ public function testDiaDosFinadosAfter1300(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testDiaDosFinadosAfter1300(): void */ public function testDiaDosFinadosBefore1300(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -69,7 +69,7 @@ public function testDiaDosFinadosBefore1300(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Dia de Finados']); } @@ -80,7 +80,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::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 2935e7fc3..13f18f583 100644 --- a/tests/Brazil/AshWednesdayTest.php +++ b/tests/Brazil/AshWednesdayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Quarta-feira de Cinzas'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Brazil/BlackConsciousnessDayTest.php b/tests/Brazil/BlackConsciousnessDayTest.php index 3a47a57bf..1f9c4c62c 100644 --- a/tests/Brazil/BlackConsciousnessDayTest.php +++ b/tests/Brazil/BlackConsciousnessDayTest.php @@ -47,7 +47,7 @@ class BlackConsciousnessDayTest extends BrazilBaseTestCase implements HolidayTes */ public function testBlackConsciousnessDay(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::OFFICIAL_YEAR - 1); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::OFFICIAL_YEAR - 1); $expectedDate = "{$year}-11-20"; $this->assertHoliday( self::REGION, @@ -67,7 +67,7 @@ public function testBlackConsciousnessDayBefore2011(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -81,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dia Nacional de Zumbi e da Consciência Negra'] ); } @@ -96,14 +96,14 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::OFFICIAL_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::OFFICIAL_YEAR - 1), Holiday::TYPE_OBSERVANCE ); $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::OFFICIAL_YEAR), + static::generateRandomYear(self::OFFICIAL_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Brazil/BrazilTest.php b/tests/Brazil/BrazilTest.php index 6c7a93511..b83479ace 100644 --- a/tests/Brazil/BrazilTest.php +++ b/tests/Brazil/BrazilTest.php @@ -37,7 +37,7 @@ class BrazilTest extends BrazilBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1980); + $this->year = static::generateRandomYear(1980); } /** diff --git a/tests/Brazil/CarnavalMondayTest.php b/tests/Brazil/CarnavalMondayTest.php index ad8004c54..4a07ebe4b 100644 --- a/tests/Brazil/CarnavalMondayTest.php +++ b/tests/Brazil/CarnavalMondayTest.php @@ -45,12 +45,12 @@ class CarnavalMondayTest extends BrazilBaseTestCase implements HolidayTestCase */ public function testCarnavalMondayAfter1700(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->sub(new \DateInterval('P48D')) + static::computeEaster($year, self::TIMEZONE)->sub(new \DateInterval('P48D')) ); } @@ -61,7 +61,7 @@ public function testCarnavalMondayAfter1700(): void */ public function testCarnavalMondayBefore1700(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -72,7 +72,7 @@ public function testCarnavalMondayBefore1700(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Segunda-feira de Carnaval']); } @@ -83,7 +83,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::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 8de9f7312..96a5479cc 100644 --- a/tests/Brazil/CarnavalTuesdayTest.php +++ b/tests/Brazil/CarnavalTuesdayTest.php @@ -45,12 +45,12 @@ class CarnavalTuesdayTest extends BrazilBaseTestCase implements HolidayTestCase */ public function testCarnavalTuesdayAfter1700(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->sub(new \DateInterval('P47D')) + static::computeEaster($year, self::TIMEZONE)->sub(new \DateInterval('P47D')) ); } @@ -61,7 +61,7 @@ public function testCarnavalTuesdayAfter1700(): void */ public function testCarnavalTuesdayBefore1700(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -72,7 +72,7 @@ public function testCarnavalTuesdayBefore1700(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Terça-feira de Carnaval']); } @@ -83,7 +83,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::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 6feb72d71..02dbb0bb1 100644 --- a/tests/Brazil/ChristmasDayTest.php +++ b/tests/Brazil/ChristmasDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Natal'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Brazil/CorpusChristiTest.php b/tests/Brazil/CorpusChristiTest.php index fc244d8bb..7ab7fe654 100644 --- a/tests/Brazil/CorpusChristiTest.php +++ b/tests/Brazil/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Corpus Christi'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Brazil/EasterTest.php b/tests/Brazil/EasterTest.php index ad45902a8..f95506240 100644 --- a/tests/Brazil/EasterTest.php +++ b/tests/Brazil/EasterTest.php @@ -41,7 +41,7 @@ class EasterTest extends BrazilBaseTestCase implements HolidayTestCase public function testEaster(): void { $year = 1948; - $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $this->calculateEaster($year, self::TIMEZONE)); + $this->assertHoliday(self::REGION, self::HOLIDAY, $year, static::computeEaster($year, self::TIMEZONE)); } /** @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Páscoa'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Brazil/GoodFridayTest.php b/tests/Brazil/GoodFridayTest.php index 078a90ab0..41b203205 100644 --- a/tests/Brazil/GoodFridayTest.php +++ b/tests/Brazil/GoodFridayTest.php @@ -45,7 +45,7 @@ public function testGoodFriday(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->sub(new \DateInterval('P2D')) + static::computeEaster($year, self::TIMEZONE)->sub(new \DateInterval('P2D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Sexta feira santa'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Brazil/IndependenceDayTest.php b/tests/Brazil/IndependenceDayTest.php index 8a4303e0e..66ecc9ab8 100644 --- a/tests/Brazil/IndependenceDayTest.php +++ b/tests/Brazil/IndependenceDayTest.php @@ -42,7 +42,7 @@ class IndependenceDayTest extends BrazilBaseTestCase implements HolidayTestCase */ public function testDiaDaIndependenciaDoBrasilAfter1822(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testDiaDaIndependenciaDoBrasilAfter1822(): void */ public function testDiaDaIndependenciaDoBrasilBefore1822(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -69,7 +69,7 @@ public function testDiaDaIndependenciaDoBrasilBefore1822(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, @@ -85,7 +85,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::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 8a14d9315..92d30a2c1 100644 --- a/tests/Brazil/InternationalWorkersDayTest.php +++ b/tests/Brazil/InternationalWorkersDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Dia internacional do trabalhador'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Brazil/NewYearsDayTest.php b/tests/Brazil/NewYearsDayTest.php index a17ff37ae..5c4cf30bf 100644 --- a/tests/Brazil/NewYearsDayTest.php +++ b/tests/Brazil/NewYearsDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ano novo'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Brazil/OurLadyOfAparecidaDayTest.php b/tests/Brazil/OurLadyOfAparecidaDayTest.php index 333193667..5db5b47ea 100644 --- a/tests/Brazil/OurLadyOfAparecidaDayTest.php +++ b/tests/Brazil/OurLadyOfAparecidaDayTest.php @@ -42,7 +42,7 @@ class OurLadyOfAparecidaDayTest extends BrazilBaseTestCase implements HolidayTes */ public function testNossaSenhoraAparecidaAfter1980(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testNossaSenhoraAparecidaAfter1980(): void */ public function testNossaSenhoraAparecidaBefore1980(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -69,7 +69,7 @@ public function testNossaSenhoraAparecidaBefore1980(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, @@ -85,7 +85,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::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 bed5b7ec0..4c7a94471 100644 --- a/tests/Brazil/ProclamationOfRepublicDayTest.php +++ b/tests/Brazil/ProclamationOfRepublicDayTest.php @@ -42,7 +42,7 @@ class ProclamationOfRepublicDayTest extends BrazilBaseTestCase implements Holida */ public function testProclamacaoDaRepublicaAfter1889(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testProclamacaoDaRepublicaAfter1889(): void */ public function testProclamacaoDaRepublicaBefore1889(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -69,7 +69,7 @@ public function testProclamacaoDaRepublicaBefore1889(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, @@ -85,7 +85,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::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 edd34ac98..d74bc8540 100644 --- a/tests/Brazil/TiradentesDayTest.php +++ b/tests/Brazil/TiradentesDayTest.php @@ -42,7 +42,7 @@ class TiradentesDayTest extends BrazilBaseTestCase implements HolidayTestCase */ public function testDiaDeTiradentesAfter1792(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testDiaDeTiradentesAfter1792(): void */ public function testDiaDeTiradentesBefore1792(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -69,7 +69,7 @@ public function testDiaDeTiradentesBefore1792(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Dia de Tiradentes']); } @@ -80,7 +80,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Bulgaria/BulgariaTest.php b/tests/Bulgaria/BulgariaTest.php index 6f75ee4b1..83a18d207 100644 --- a/tests/Bulgaria/BulgariaTest.php +++ b/tests/Bulgaria/BulgariaTest.php @@ -26,7 +26,7 @@ class BulgariaTest extends BulgariaBaseTestCase implements ProviderTestCase protected function setUp(): void { - $this->year = $this->generateRandomYear(); + $this->year = static::generateRandomYear(); } public function testOfficialHolidays(): void diff --git a/tests/Bulgaria/ChristmasDayTest.php b/tests/Bulgaria/ChristmasDayTest.php index f45aa287d..478644099 100644 --- a/tests/Bulgaria/ChristmasDayTest.php +++ b/tests/Bulgaria/ChristmasDayTest.php @@ -26,7 +26,7 @@ class ChristmasDayTest extends BulgariaBaseTestCase implements HolidayTestCase public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -40,7 +40,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Рождество Христово'] ); } @@ -50,7 +50,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/ChristmasEveTest.php b/tests/Bulgaria/ChristmasEveTest.php index 7cb617308..193f74a1f 100644 --- a/tests/Bulgaria/ChristmasEveTest.php +++ b/tests/Bulgaria/ChristmasEveTest.php @@ -26,7 +26,7 @@ class ChristmasEveTest extends BulgariaBaseTestCase implements HolidayTestCase public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -40,7 +40,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Бъдни вечер'] ); } @@ -50,7 +50,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/EducationCultureSlavonicLiteratureDayTest.php b/tests/Bulgaria/EducationCultureSlavonicLiteratureDayTest.php index ff3560172..d39d9220b 100644 --- a/tests/Bulgaria/EducationCultureSlavonicLiteratureDayTest.php +++ b/tests/Bulgaria/EducationCultureSlavonicLiteratureDayTest.php @@ -28,7 +28,7 @@ class EducationCultureSlavonicLiteratureDayTest extends BulgariaBaseTestCase imp public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -42,7 +42,7 @@ public function testNotHoliday(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -51,7 +51,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Ден на българската просвета и култура и на славянската писменост'] ); } @@ -61,7 +61,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/IndependenceDayTest.php b/tests/Bulgaria/IndependenceDayTest.php index 7b5107c49..3b4d79d86 100644 --- a/tests/Bulgaria/IndependenceDayTest.php +++ b/tests/Bulgaria/IndependenceDayTest.php @@ -28,7 +28,7 @@ class IndependenceDayTest extends BulgariaBaseTestCase implements HolidayTestCas public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -42,7 +42,7 @@ public function testNotHoliday(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -51,7 +51,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Ден на Независимостта на България'] ); } @@ -61,7 +61,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/InternationalWorkersDayTest.php b/tests/Bulgaria/InternationalWorkersDayTest.php index c429a479d..6b70b2b75 100644 --- a/tests/Bulgaria/InternationalWorkersDayTest.php +++ b/tests/Bulgaria/InternationalWorkersDayTest.php @@ -26,7 +26,7 @@ class InternationalWorkersDayTest extends BulgariaBaseTestCase implements Holida public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -40,7 +40,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ден на труда и на международната работническа солидарност'] ); } @@ -50,7 +50,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/LiberationDayTest.php b/tests/Bulgaria/LiberationDayTest.php index 43a8d8ec4..eb398b93c 100644 --- a/tests/Bulgaria/LiberationDayTest.php +++ b/tests/Bulgaria/LiberationDayTest.php @@ -33,7 +33,7 @@ class LiberationDayTest extends BulgariaBaseTestCase implements HolidayTestCase public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -47,7 +47,7 @@ public function testNotHoliday(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Ден на Освобождението на България от османско иго'] ); } @@ -66,7 +66,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/NewYearsDayTest.php b/tests/Bulgaria/NewYearsDayTest.php index cf63affef..a79682fef 100644 --- a/tests/Bulgaria/NewYearsDayTest.php +++ b/tests/Bulgaria/NewYearsDayTest.php @@ -26,7 +26,7 @@ class NewYearsDayTest extends BulgariaBaseTestCase implements HolidayTestCase public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -40,7 +40,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Нова година'] ); } @@ -50,7 +50,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/OrthodoxEasterMondayTest.php b/tests/Bulgaria/OrthodoxEasterMondayTest.php index 32c85ceb1..b02a7ac85 100644 --- a/tests/Bulgaria/OrthodoxEasterMondayTest.php +++ b/tests/Bulgaria/OrthodoxEasterMondayTest.php @@ -47,7 +47,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Велики понеделник'] ); } @@ -57,7 +57,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/OrthodoxEasterTest.php b/tests/Bulgaria/OrthodoxEasterTest.php index 09ce13abd..14c0abcd1 100644 --- a/tests/Bulgaria/OrthodoxEasterTest.php +++ b/tests/Bulgaria/OrthodoxEasterTest.php @@ -44,7 +44,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Великден'] ); } @@ -54,7 +54,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/OrthodoxGoodFridayTest.php b/tests/Bulgaria/OrthodoxGoodFridayTest.php index c8d0f35cb..b401d5d82 100644 --- a/tests/Bulgaria/OrthodoxGoodFridayTest.php +++ b/tests/Bulgaria/OrthodoxGoodFridayTest.php @@ -47,7 +47,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Разпети петък'] ); } @@ -57,7 +57,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/SecondChristmasDayTest.php b/tests/Bulgaria/SecondChristmasDayTest.php index 9b859935d..3936d8806 100644 --- a/tests/Bulgaria/SecondChristmasDayTest.php +++ b/tests/Bulgaria/SecondChristmasDayTest.php @@ -26,7 +26,7 @@ class SecondChristmasDayTest extends BulgariaBaseTestCase implements HolidayTest public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -40,7 +40,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Втори ден на Коледа'] ); } @@ -50,7 +50,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/UnificationDayTest.php b/tests/Bulgaria/UnificationDayTest.php index 6492017fd..022768d73 100644 --- a/tests/Bulgaria/UnificationDayTest.php +++ b/tests/Bulgaria/UnificationDayTest.php @@ -28,7 +28,7 @@ class UnificationDayTest extends BulgariaBaseTestCase implements HolidayTestCase public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -42,7 +42,7 @@ public function testNotHoliday(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -51,7 +51,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Ден на Съединението'] ); } @@ -61,7 +61,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Bulgaria/stGeorgesDayTest.php b/tests/Bulgaria/stGeorgesDayTest.php index 9c1b72e90..b889056ea 100644 --- a/tests/Bulgaria/stGeorgesDayTest.php +++ b/tests/Bulgaria/stGeorgesDayTest.php @@ -26,7 +26,7 @@ class stGeorgesDayTest extends BulgariaBaseTestCase implements HolidayTestCase public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -40,7 +40,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Гергьовден, ден на храбростта и Българската армия'] ); } @@ -50,7 +50,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Canada/Alberta/AlbertaTest.php b/tests/Canada/Alberta/AlbertaTest.php index d11c1997e..8ff2d71bc 100644 --- a/tests/Canada/Alberta/AlbertaTest.php +++ b/tests/Canada/Alberta/AlbertaTest.php @@ -37,7 +37,7 @@ class AlbertaTest extends AlbertaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/BritishColumbia/BritishColumbiaTest.php b/tests/Canada/BritishColumbia/BritishColumbiaTest.php index 5be9c4a4c..535bcf910 100644 --- a/tests/Canada/BritishColumbia/BritishColumbiaTest.php +++ b/tests/Canada/BritishColumbia/BritishColumbiaTest.php @@ -37,7 +37,7 @@ class BritishColumbiaTest extends BritishColumbiaBaseTestCase implements Provide */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/CanadaDayTest.php b/tests/Canada/CanadaDayTest.php index 81c5d5df8..9d38ee631 100644 --- a/tests/Canada/CanadaDayTest.php +++ b/tests/Canada/CanadaDayTest.php @@ -68,7 +68,7 @@ public function testCanadaDayBefore1879(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -82,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Canada Day'] ); } @@ -97,7 +97,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Canada/CanadaTest.php b/tests/Canada/CanadaTest.php index b6749a822..f2312307b 100644 --- a/tests/Canada/CanadaTest.php +++ b/tests/Canada/CanadaTest.php @@ -37,7 +37,7 @@ class CanadaTest extends CanadaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1986); + $this->year = static::generateRandomYear(1986); } /** diff --git a/tests/Canada/ChristmasDayTest.php b/tests/Canada/ChristmasDayTest.php index 3db48cc3a..4f81481cf 100644 --- a/tests/Canada/ChristmasDayTest.php +++ b/tests/Canada/ChristmasDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Canada/LabourDayTest.php b/tests/Canada/LabourDayTest.php index 2dfbe847c..8f93afc2b 100644 --- a/tests/Canada/LabourDayTest.php +++ b/tests/Canada/LabourDayTest.php @@ -42,7 +42,7 @@ class LabourDayTest extends CanadaBaseTestCase implements HolidayTestCase */ public function testLabourDayOnAfter1894(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testLabourDayBefore1894(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Labour Day'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Canada/Manitoba/ManitobaTest.php b/tests/Canada/Manitoba/ManitobaTest.php index b292b58f9..36b927cb4 100644 --- a/tests/Canada/Manitoba/ManitobaTest.php +++ b/tests/Canada/Manitoba/ManitobaTest.php @@ -37,7 +37,7 @@ class ManitobaTest extends ManitobaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/NewBrunswick/NewBrunswickTest.php b/tests/Canada/NewBrunswick/NewBrunswickTest.php index f4934d24f..693396c02 100644 --- a/tests/Canada/NewBrunswick/NewBrunswickTest.php +++ b/tests/Canada/NewBrunswick/NewBrunswickTest.php @@ -37,7 +37,7 @@ class NewBrunswickTest extends NewBrunswickBaseTestCase implements ProviderTestC */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/NewYearsDayTest.php b/tests/Canada/NewYearsDayTest.php index 1ad5e86ec..efcbf271e 100644 --- a/tests/Canada/NewYearsDayTest.php +++ b/tests/Canada/NewYearsDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'New Year’s Day'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Canada/NewfoundlandAndLabrador/NewfoundlandAndLabradorTest.php b/tests/Canada/NewfoundlandAndLabrador/NewfoundlandAndLabradorTest.php index d0bd824b0..baacef0e3 100644 --- a/tests/Canada/NewfoundlandAndLabrador/NewfoundlandAndLabradorTest.php +++ b/tests/Canada/NewfoundlandAndLabrador/NewfoundlandAndLabradorTest.php @@ -37,7 +37,7 @@ class NewfoundlandAndLabradorTest extends NewfoundlandAndLabradorBaseTestCase im */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/NorthwestTerritories/NorthwestTerritoriesTest.php b/tests/Canada/NorthwestTerritories/NorthwestTerritoriesTest.php index c758d778a..8713dc406 100644 --- a/tests/Canada/NorthwestTerritories/NorthwestTerritoriesTest.php +++ b/tests/Canada/NorthwestTerritories/NorthwestTerritoriesTest.php @@ -37,7 +37,7 @@ class NorthwestTerritoriesTest extends NorthwestTerritoriesBaseTestCase implemen */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/NovaScotia/NovaScotiaTest.php b/tests/Canada/NovaScotia/NovaScotiaTest.php index 2e9ebf567..3817f5337 100644 --- a/tests/Canada/NovaScotia/NovaScotiaTest.php +++ b/tests/Canada/NovaScotia/NovaScotiaTest.php @@ -37,7 +37,7 @@ class NovaScotiaTest extends NovaScotiaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/Nunavut/NunavutDayTest.php b/tests/Canada/Nunavut/NunavutDayTest.php index ba1abe4c5..39ff08a52 100644 --- a/tests/Canada/Nunavut/NunavutDayTest.php +++ b/tests/Canada/Nunavut/NunavutDayTest.php @@ -33,7 +33,7 @@ class NunavutDayTest extends NunavutBaseTestCase implements HolidayTestCase public function testNunavutDayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -47,7 +47,7 @@ public function testLabourDayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Nunavut Day'] ); } @@ -66,7 +66,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OBSERVANCE ); } diff --git a/tests/Canada/Nunavut/NunavutTest.php b/tests/Canada/Nunavut/NunavutTest.php index b965c2abc..609cdcfcb 100644 --- a/tests/Canada/Nunavut/NunavutTest.php +++ b/tests/Canada/Nunavut/NunavutTest.php @@ -37,7 +37,7 @@ class NunavutTest extends NunavutBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/Ontario/OntarioTest.php b/tests/Canada/Ontario/OntarioTest.php index ddb80bede..e3b00c7a0 100644 --- a/tests/Canada/Ontario/OntarioTest.php +++ b/tests/Canada/Ontario/OntarioTest.php @@ -37,7 +37,7 @@ class OntarioTest extends OntarioBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/PrinceEdwardIsland/PrinceEdwardIslandTest.php b/tests/Canada/PrinceEdwardIsland/PrinceEdwardIslandTest.php index e8a3fac5a..7dabc7b53 100644 --- a/tests/Canada/PrinceEdwardIsland/PrinceEdwardIslandTest.php +++ b/tests/Canada/PrinceEdwardIsland/PrinceEdwardIslandTest.php @@ -37,7 +37,7 @@ class PrinceEdwardIslandTest extends PrinceEdwardIslandBaseTestCase implements P */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/Quebec/QuebecTest.php b/tests/Canada/Quebec/QuebecTest.php index 4d582f594..5f2b287cb 100644 --- a/tests/Canada/Quebec/QuebecTest.php +++ b/tests/Canada/Quebec/QuebecTest.php @@ -37,7 +37,7 @@ class QuebecTest extends QuebecBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/RemembranceDayTest.php b/tests/Canada/RemembranceDayTest.php index ab98dbcbf..cab9a6f03 100644 --- a/tests/Canada/RemembranceDayTest.php +++ b/tests/Canada/RemembranceDayTest.php @@ -42,7 +42,7 @@ class RemembranceDayTest extends CanadaBaseTestCase implements HolidayTestCase */ public function testRemembranceDayOnAfter1919(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testVeteransDayBefore1919(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1954), + static::generateRandomYear(1954), [self::LOCALE => 'Remembrance Day'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Canada/Saskatchewan/SaskatchewanTest.php b/tests/Canada/Saskatchewan/SaskatchewanTest.php index 329686a06..717217987 100644 --- a/tests/Canada/Saskatchewan/SaskatchewanTest.php +++ b/tests/Canada/Saskatchewan/SaskatchewanTest.php @@ -37,7 +37,7 @@ class SaskatchewanTest extends SaskatchewanBaseTestCase implements ProviderTestC */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Canada/ThanksgivingDayTest.php b/tests/Canada/ThanksgivingDayTest.php index 78f9ad692..3550c86b9 100644 --- a/tests/Canada/ThanksgivingDayTest.php +++ b/tests/Canada/ThanksgivingDayTest.php @@ -43,7 +43,7 @@ class ThanksgivingDayTest extends CanadaBaseTestCase implements HolidayTestCase */ public function testThanksgivingDayOnAfter1879(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testThanksgivingDayBefore1879(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -77,7 +77,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Thanksgiving'] ); } @@ -92,7 +92,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Canada/TruthAndReconciliationDayTest.php b/tests/Canada/TruthAndReconciliationDayTest.php index fba6f73b1..704eca2bf 100644 --- a/tests/Canada/TruthAndReconciliationDayTest.php +++ b/tests/Canada/TruthAndReconciliationDayTest.php @@ -43,7 +43,7 @@ class TruthAndReconciliationDayTest extends CanadaBaseTestCase implements Holida */ public function testTruthAndReconciliationDayOnAfter2021(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testTruthAndReconciliationDayBefore2021(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -77,7 +77,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'National Day For Truth And Reconciliation'] ); } @@ -92,7 +92,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Canada/Yukon/YukonTest.php b/tests/Canada/Yukon/YukonTest.php index 90be86646..f9f058fea 100644 --- a/tests/Canada/Yukon/YukonTest.php +++ b/tests/Canada/Yukon/YukonTest.php @@ -37,7 +37,7 @@ class YukonTest extends YukonBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** diff --git a/tests/Croatia/AllSaintsDayTest.php b/tests/Croatia/AllSaintsDayTest.php index 4d73a8621..232100044 100644 --- a/tests/Croatia/AllSaintsDayTest.php +++ b/tests/Croatia/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends CroatiaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Dan svih svetih'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Croatia/AntifascistStruggleDayTest.php b/tests/Croatia/AntifascistStruggleDayTest.php index 75015d818..a3f20862f 100644 --- a/tests/Croatia/AntifascistStruggleDayTest.php +++ b/tests/Croatia/AntifascistStruggleDayTest.php @@ -42,7 +42,7 @@ class AntifascistStruggleDayTest extends CroatiaBaseTestCase implements HolidayT */ public function testAntifascistStruggleDayOnAfter1941(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testAntifascistStruggleDayBefore1941(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dan antifašističke borbe'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Croatia/AssumptionOfMaryTest.php b/tests/Croatia/AssumptionOfMaryTest.php index 141bea603..c73942f9d 100644 --- a/tests/Croatia/AssumptionOfMaryTest.php +++ b/tests/Croatia/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends CroatiaBaseTestCase implements HolidayTestCas /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Velika Gospa'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Croatia/ChristmasDayTest.php b/tests/Croatia/ChristmasDayTest.php index 88326d22d..130acb1d3 100644 --- a/tests/Croatia/ChristmasDayTest.php +++ b/tests/Croatia/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends CroatiaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Božić'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Croatia/CorpusChristiTest.php b/tests/Croatia/CorpusChristiTest.php index 510fd8424..6c142034d 100644 --- a/tests/Croatia/CorpusChristiTest.php +++ b/tests/Croatia/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Tijelovo'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Croatia/CroatiaTest.php b/tests/Croatia/CroatiaTest.php index b130f7dc9..0b6c65db9 100644 --- a/tests/Croatia/CroatiaTest.php +++ b/tests/Croatia/CroatiaTest.php @@ -37,7 +37,7 @@ class CroatiaTest extends CroatiaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1941); + $this->year = static::generateRandomYear(1941); } /** diff --git a/tests/Croatia/EasterMondayTest.php b/tests/Croatia/EasterMondayTest.php index 99e6b249c..c9725b171 100644 --- a/tests/Croatia/EasterMondayTest.php +++ b/tests/Croatia/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Uskršnji ponedjeljak'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Croatia/EasterTest.php b/tests/Croatia/EasterTest.php index f56214c69..4845dca52 100644 --- a/tests/Croatia/EasterTest.php +++ b/tests/Croatia/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Uskrs'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Croatia/EpiphanyTest.php b/tests/Croatia/EpiphanyTest.php index f4a54efe5..3621056e5 100644 --- a/tests/Croatia/EpiphanyTest.php +++ b/tests/Croatia/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends CroatiaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Sveta tri kralja'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Croatia/HomelandThanksgivingDayTest.php b/tests/Croatia/HomelandThanksgivingDayTest.php index b6f33d722..c89add0a5 100644 --- a/tests/Croatia/HomelandThanksgivingDayTest.php +++ b/tests/Croatia/HomelandThanksgivingDayTest.php @@ -47,7 +47,7 @@ class HomelandThanksgivingDayTest extends CroatiaBaseTestCase implements Holiday */ public function testHomelandThanksgivingDayOnAfter1995(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -66,7 +66,7 @@ public function testHomelandThanksgivingDayBefore1995(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -77,7 +77,7 @@ public function testHomelandThanksgivingDayBefore1995(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::NAME_CHANGED_YEAR - 1); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::NAME_CHANGED_YEAR - 1); $expectedText = 'Dan domovinske zahvalnosti'; $this->assertTranslatedHolidayName( self::REGION, @@ -86,7 +86,7 @@ public function testTranslation(): void [self::LOCALE => $expectedText] ); - $year = $this->generateRandomYear(self::NAME_CHANGED_YEAR); + $year = static::generateRandomYear(self::NAME_CHANGED_YEAR); $expectedText = 'Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja'; $this->assertTranslatedHolidayName( self::REGION, @@ -106,7 +106,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Croatia/IndependenceDayTest.php b/tests/Croatia/IndependenceDayTest.php index 70b226034..5bbfba4f0 100644 --- a/tests/Croatia/IndependenceDayTest.php +++ b/tests/Croatia/IndependenceDayTest.php @@ -47,7 +47,7 @@ class IndependenceDayTest extends CroatiaBaseTestCase implements HolidayTestCase */ public function testIndependenceDayOnAfter1991(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::DISBANDMENT_YEAR - 1); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::DISBANDMENT_YEAR - 1); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -66,7 +66,7 @@ public function testIndependenceDayBefore1991(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -80,7 +80,7 @@ public function testIndependenceDayAfterDisbandment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::DISBANDMENT_YEAR) + static::generateRandomYear(self::DISBANDMENT_YEAR) ); } @@ -94,7 +94,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::DISBANDMENT_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::DISBANDMENT_YEAR - 1), [self::LOCALE => 'Dan neovisnosti'] ); } @@ -109,7 +109,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::DISBANDMENT_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::DISBANDMENT_YEAR - 1), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Croatia/InternationalWorkersDayTest.php b/tests/Croatia/InternationalWorkersDayTest.php index 6e2bc35bd..50a449e26 100644 --- a/tests/Croatia/InternationalWorkersDayTest.php +++ b/tests/Croatia/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends CroatiaBaseTestCase implements Holiday /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Praznik rada'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Croatia/NewYearsDayTest.php b/tests/Croatia/NewYearsDayTest.php index b7a67ad51..73d2f6b60 100644 --- a/tests/Croatia/NewYearsDayTest.php +++ b/tests/Croatia/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends CroatiaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nova godina'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Croatia/RemembranceDayTest.php b/tests/Croatia/RemembranceDayTest.php index 02ac0b90a..7e032ab88 100644 --- a/tests/Croatia/RemembranceDayTest.php +++ b/tests/Croatia/RemembranceDayTest.php @@ -42,7 +42,7 @@ class RemembranceDayTest extends CroatiaBaseTestCase implements HolidayTestCase */ public function testRemembranceDayAfterItWasEstablished(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testRemembranceDayBeforeItWasEstablished(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dan sjećanja na žrtve Domovinskog rata i Dan sjećanja na žrtvu Vukovara i Škabrnje'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Croatia/StStephensDayTest.php b/tests/Croatia/StStephensDayTest.php index 93ec20c6f..0475ed46e 100644 --- a/tests/Croatia/StStephensDayTest.php +++ b/tests/Croatia/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends CroatiaBaseTestCase implements HolidayTestCase /** * Tests the day of St. Stephen's Day. * - * @dataProvider stStephensDayDataProvider - * * @param int $year the year for which St. Stephen's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('stStephensDayDataProvider')] public function teststStephensDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function teststStephensDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function stStephensDayDataProvider(): array + public static function stStephensDayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Sveti Stjepan'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Croatia/StatehoodDayTest.php b/tests/Croatia/StatehoodDayTest.php index 71246a4ae..497027865 100644 --- a/tests/Croatia/StatehoodDayTest.php +++ b/tests/Croatia/StatehoodDayTest.php @@ -47,7 +47,7 @@ class StatehoodDayTest extends CroatiaBaseTestCase implements HolidayTestCase */ public function testStatehoodDay(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::DATE_CHANGE_YEAR - 1); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::DATE_CHANGE_YEAR - 1); $expectedDate = "{$year}-6-25"; $this->assertHoliday( self::REGION, @@ -56,7 +56,7 @@ public function testStatehoodDay(): void new \DateTime($expectedDate, new \DateTimeZone(self::TIMEZONE)) ); - $year = $this->generateRandomYear(self::DATE_CHANGE_YEAR); + $year = static::generateRandomYear(self::DATE_CHANGE_YEAR); $expectedDate = "{$year}-5-30"; $this->assertHoliday( self::REGION, @@ -76,7 +76,7 @@ public function testStatehoodDayBefore1991(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -90,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dan državnosti'] ); } @@ -105,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/CzechRepublic/ChristmasDayTest.php b/tests/CzechRepublic/ChristmasDayTest.php index 6d17d95d7..8a2da6a29 100644 --- a/tests/CzechRepublic/ChristmasDayTest.php +++ b/tests/CzechRepublic/ChristmasDayTest.php @@ -37,11 +37,10 @@ class ChristmasDayTest extends CzechRepublicBaseTestCase implements HolidayTestC /** * Tests Christmas Day. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -54,9 +53,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -69,7 +68,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => '1. svátek vánoční'] ); } @@ -81,6 +80,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/ChristmasEveTest.php b/tests/CzechRepublic/ChristmasEveTest.php index 9d6979cac..3b23a4c87 100644 --- a/tests/CzechRepublic/ChristmasEveTest.php +++ b/tests/CzechRepublic/ChristmasEveTest.php @@ -37,11 +37,10 @@ class ChristmasEveTest extends CzechRepublicBaseTestCase implements HolidayTestC /** * Tests Christmas Eve. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which Christmas Eve needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -54,9 +53,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 24, self::TIMEZONE); + return static::generateRandomDates(12, 24, self::TIMEZONE); } /** @@ -69,7 +68,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Štědrý den'] ); } @@ -81,6 +80,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/CzechRepublicTest.php b/tests/CzechRepublic/CzechRepublicTest.php index cd14422f6..04f8bc9fd 100644 --- a/tests/CzechRepublic/CzechRepublicTest.php +++ b/tests/CzechRepublic/CzechRepublicTest.php @@ -41,7 +41,7 @@ class CzechRepublicTest extends CzechRepublicBaseTestCase implements ProviderTes */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** diff --git a/tests/CzechRepublic/CzechStateHoodDayTest.php b/tests/CzechRepublic/CzechStateHoodDayTest.php index 24f5a48f7..25d7fff23 100644 --- a/tests/CzechRepublic/CzechStateHoodDayTest.php +++ b/tests/CzechRepublic/CzechStateHoodDayTest.php @@ -37,11 +37,10 @@ class CzechStateHoodDayTest extends CzechRepublicBaseTestCase implements Holiday /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -54,9 +53,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(9, 28, self::TIMEZONE); + return static::generateRandomDates(9, 28, self::TIMEZONE); } /** @@ -69,7 +68,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Den české státnosti'] ); } @@ -81,6 +80,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/EasterMondayTest.php b/tests/CzechRepublic/EasterMondayTest.php index 7c2716ec9..d22bc22ac 100644 --- a/tests/CzechRepublic/EasterMondayTest.php +++ b/tests/CzechRepublic/EasterMondayTest.php @@ -60,7 +60,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Velikonoční pondělí'] ); } @@ -72,6 +72,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/GoodFridayTest.php b/tests/CzechRepublic/GoodFridayTest.php index 38a0436d1..76001f8fe 100644 --- a/tests/CzechRepublic/GoodFridayTest.php +++ b/tests/CzechRepublic/GoodFridayTest.php @@ -60,7 +60,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Velký pátek'] ); } @@ -72,6 +72,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/IndependentCzechoslovakStateDayTest.php b/tests/CzechRepublic/IndependentCzechoslovakStateDayTest.php index 340db24f6..5e9a64839 100644 --- a/tests/CzechRepublic/IndependentCzechoslovakStateDayTest.php +++ b/tests/CzechRepublic/IndependentCzechoslovakStateDayTest.php @@ -33,11 +33,10 @@ class IndependentCzechoslovakStateDayTest extends CzechRepublicBaseTestCase impl /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(10, 28, self::TIMEZONE); + return static::generateRandomDates(10, 28, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Den vzniku samostatného československého státu'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/InternationalWorkersDayTest.php b/tests/CzechRepublic/InternationalWorkersDayTest.php index 7025229a9..9ebd71e84 100644 --- a/tests/CzechRepublic/InternationalWorkersDayTest.php +++ b/tests/CzechRepublic/InternationalWorkersDayTest.php @@ -37,11 +37,10 @@ class InternationalWorkersDayTest extends CzechRepublicBaseTestCase implements H /** * Tests International Workers' Day. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which International Workers' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -57,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Svátek práce'] ); } @@ -69,7 +68,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -79,8 +78,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/CzechRepublic/JanHusDayTest.php b/tests/CzechRepublic/JanHusDayTest.php index 56110e877..33d1f880e 100644 --- a/tests/CzechRepublic/JanHusDayTest.php +++ b/tests/CzechRepublic/JanHusDayTest.php @@ -33,11 +33,10 @@ class JanHusDayTest extends CzechRepublicBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(7, 6, self::TIMEZONE); + return static::generateRandomDates(7, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Den upálení mistra Jana Husa'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/NewYearsDayTest.php b/tests/CzechRepublic/NewYearsDayTest.php index c76eacdb1..ae86d5485 100644 --- a/tests/CzechRepublic/NewYearsDayTest.php +++ b/tests/CzechRepublic/NewYearsDayTest.php @@ -37,11 +37,10 @@ class NewYearsDayTest extends CzechRepublicBaseTestCase implements HolidayTestCa /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -54,9 +53,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -69,7 +68,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nový rok'] ); } @@ -81,6 +80,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/RenewalOfIndependentCzechStateDayTest.php b/tests/CzechRepublic/RenewalOfIndependentCzechStateDayTest.php index ff6be1c2b..7c2daa30e 100644 --- a/tests/CzechRepublic/RenewalOfIndependentCzechStateDayTest.php +++ b/tests/CzechRepublic/RenewalOfIndependentCzechStateDayTest.php @@ -36,11 +36,10 @@ class RenewalOfIndependentCzechStateDayTest extends CzechRepublicBaseTestCase im /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,9 +52,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -68,7 +67,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Den obnovy samostatného českého státu'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/SaintsCyrilAndMethodiusDayTest.php b/tests/CzechRepublic/SaintsCyrilAndMethodiusDayTest.php index dd2b13941..866e2fb39 100644 --- a/tests/CzechRepublic/SaintsCyrilAndMethodiusDayTest.php +++ b/tests/CzechRepublic/SaintsCyrilAndMethodiusDayTest.php @@ -37,11 +37,10 @@ class SaintsCyrilAndMethodiusDayTest extends CzechRepublicBaseTestCase implement /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -54,9 +53,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(7, 5, self::TIMEZONE); + return static::generateRandomDates(7, 5, self::TIMEZONE); } /** @@ -69,7 +68,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Den slovanských věrozvěstů Cyrila a Metoděje'] ); } @@ -81,6 +80,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/SecondChristmasDayTest.php b/tests/CzechRepublic/SecondChristmasDayTest.php index 5d88d1628..0e9c02df4 100644 --- a/tests/CzechRepublic/SecondChristmasDayTest.php +++ b/tests/CzechRepublic/SecondChristmasDayTest.php @@ -37,11 +37,10 @@ class SecondChristmasDayTest extends CzechRepublicBaseTestCase implements Holida /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -54,9 +53,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -69,7 +68,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => '2. svátek vánoční'] ); } @@ -81,6 +80,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/StruggleForFreedomAndDemocracyDayTest.php b/tests/CzechRepublic/StruggleForFreedomAndDemocracyDayTest.php index 1db2b06fd..4604ba145 100644 --- a/tests/CzechRepublic/StruggleForFreedomAndDemocracyDayTest.php +++ b/tests/CzechRepublic/StruggleForFreedomAndDemocracyDayTest.php @@ -33,11 +33,10 @@ class StruggleForFreedomAndDemocracyDayTest extends CzechRepublicBaseTestCase im /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 17, self::TIMEZONE); + return static::generateRandomDates(11, 17, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Den boje za svobodu a demokracii'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/CzechRepublic/VictoryInEuropeDayTest.php b/tests/CzechRepublic/VictoryInEuropeDayTest.php index 4d11b818a..252a41327 100644 --- a/tests/CzechRepublic/VictoryInEuropeDayTest.php +++ b/tests/CzechRepublic/VictoryInEuropeDayTest.php @@ -37,11 +37,10 @@ class VictoryInEuropeDayTest extends CzechRepublicBaseTestCase implements Holida /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -54,9 +53,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 8, self::TIMEZONE); + return static::generateRandomDates(5, 8, self::TIMEZONE); } /** @@ -69,7 +68,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Den vítězství'] ); } @@ -81,6 +80,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Denmark/AscensionDayTest.php b/tests/Denmark/AscensionDayTest.php index 392a3f98a..602627541 100644 --- a/tests/Denmark/AscensionDayTest.php +++ b/tests/Denmark/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Kristi himmelfartsdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Denmark/ChristmasDayTest.php b/tests/Denmark/ChristmasDayTest.php index 08aa7ede9..f4cf78868 100644 --- a/tests/Denmark/ChristmasDayTest.php +++ b/tests/Denmark/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends DenmarkBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'juledag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Denmark/ChristmasEveTest.php b/tests/Denmark/ChristmasEveTest.php index 1a3180ce1..df1117740 100644 --- a/tests/Denmark/ChristmasEveTest.php +++ b/tests/Denmark/ChristmasEveTest.php @@ -33,11 +33,10 @@ class ChristmasEveTest extends DenmarkBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 24, self::TIMEZONE); + return static::generateRandomDates(12, 24, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'juleaften'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Denmark/ConstitutionDayTest.php b/tests/Denmark/ConstitutionDayTest.php index 7ead563d9..859ff182e 100644 --- a/tests/Denmark/ConstitutionDayTest.php +++ b/tests/Denmark/ConstitutionDayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'grundlovsdag'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OBSERVANCE ); } diff --git a/tests/Denmark/DenmarkTest.php b/tests/Denmark/DenmarkTest.php index f57ba005c..b20b3c890 100644 --- a/tests/Denmark/DenmarkTest.php +++ b/tests/Denmark/DenmarkTest.php @@ -37,7 +37,7 @@ class DenmarkTest extends DenmarkBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(2024); + $this->year = static::generateRandomYear(2024); } /** diff --git a/tests/Denmark/EasterMondayTest.php b/tests/Denmark/EasterMondayTest.php index f633914cd..1a1229ada 100644 --- a/tests/Denmark/EasterMondayTest.php +++ b/tests/Denmark/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => '2. påskedag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Denmark/EasterTest.php b/tests/Denmark/EasterTest.php index 9c26440e4..177300ede 100644 --- a/tests/Denmark/EasterTest.php +++ b/tests/Denmark/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'påskedag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Denmark/GoodFridayTest.php b/tests/Denmark/GoodFridayTest.php index 37a86fa10..c21cee9e7 100644 --- a/tests/Denmark/GoodFridayTest.php +++ b/tests/Denmark/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'langfredag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Denmark/GreatPrayerDayTest.php b/tests/Denmark/GreatPrayerDayTest.php index 2cebb886f..3f130563b 100644 --- a/tests/Denmark/GreatPrayerDayTest.php +++ b/tests/Denmark/GreatPrayerDayTest.php @@ -66,7 +66,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -80,7 +80,7 @@ public function testHolidayAfterAbolishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ABOLISHMENT_YEAR) + static::generateRandomYear(self::ABOLISHMENT_YEAR) ); } @@ -94,7 +94,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ABOLISHMENT_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ABOLISHMENT_YEAR - 1), [self::LOCALE => 'store bededag'] ); } @@ -109,7 +109,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ABOLISHMENT_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ABOLISHMENT_YEAR - 1), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Denmark/InternationalWorkersDayTest.php b/tests/Denmark/InternationalWorkersDayTest.php index 5ea8cb849..df4688b21 100644 --- a/tests/Denmark/InternationalWorkersDayTest.php +++ b/tests/Denmark/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends DenmarkBaseTestCase implements Holiday /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testInternationalWorkersDay(int $year, \DateTimeInterface $expec * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'første maj'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Denmark/MaundyThursdayTest.php b/tests/Denmark/MaundyThursdayTest.php index 867c97bb8..dec941d3b 100644 --- a/tests/Denmark/MaundyThursdayTest.php +++ b/tests/Denmark/MaundyThursdayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'skærtorsdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Denmark/NewYearsDayTest.php b/tests/Denmark/NewYearsDayTest.php index 345754f36..d1e935e4b 100644 --- a/tests/Denmark/NewYearsDayTest.php +++ b/tests/Denmark/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends DenmarkBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'nytårsdag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Denmark/NewYearsEveTest.php b/tests/Denmark/NewYearsEveTest.php index 675df28a9..b4bffe70a 100644 --- a/tests/Denmark/NewYearsEveTest.php +++ b/tests/Denmark/NewYearsEveTest.php @@ -33,11 +33,10 @@ class NewYearsEveTest extends DenmarkBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 31, self::TIMEZONE); + return static::generateRandomDates(12, 31, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'nytårsaften'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Denmark/PentecostMondayTest.php b/tests/Denmark/PentecostMondayTest.php index 1f07be546..86d754ae8 100644 --- a/tests/Denmark/PentecostMondayTest.php +++ b/tests/Denmark/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => '2. pinsedag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Denmark/PentecostTest.php b/tests/Denmark/PentecostTest.php index 831ab414c..eea3e006f 100644 --- a/tests/Denmark/PentecostTest.php +++ b/tests/Denmark/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'pinsedag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Denmark/SecondChristmasDayTest.php b/tests/Denmark/SecondChristmasDayTest.php index 2df21536c..75daa1d26 100644 --- a/tests/Denmark/SecondChristmasDayTest.php +++ b/tests/Denmark/SecondChristmasDayTest.php @@ -33,11 +33,10 @@ class SecondChristmasDayTest extends DenmarkBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => '2. juledag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Estonia/ChristmasDayTest.php b/tests/Estonia/ChristmasDayTest.php index 960257ab0..b17fc318c 100644 --- a/tests/Estonia/ChristmasDayTest.php +++ b/tests/Estonia/ChristmasDayTest.php @@ -37,14 +37,12 @@ class ChristmasDayTest extends EstoniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Esimene jõulupüha'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Estonia/ChristmasEveDayTest.php b/tests/Estonia/ChristmasEveDayTest.php index d6ae8bd0c..7afb35c62 100644 --- a/tests/Estonia/ChristmasEveDayTest.php +++ b/tests/Estonia/ChristmasEveDayTest.php @@ -37,14 +37,12 @@ class ChristmasEveDayTest extends EstoniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(12, 24, self::TIMEZONE); + return static::generateRandomDates(12, 24, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Jõululaupäev'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Estonia/EasterDayTest.php b/tests/Estonia/EasterDayTest.php index 461f9a706..0cfd3ff63 100644 --- a/tests/Estonia/EasterDayTest.php +++ b/tests/Estonia/EasterDayTest.php @@ -37,21 +37,20 @@ class EasterDayTest extends EstoniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomEasterDates(self::TIMEZONE); + return static::generateRandomEasterDates(self::TIMEZONE); } /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ülestõusmispühade 1. püha'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Estonia/EstoniaTest.php b/tests/Estonia/EstoniaTest.php index 64c19370a..7a4fb5e3b 100644 --- a/tests/Estonia/EstoniaTest.php +++ b/tests/Estonia/EstoniaTest.php @@ -47,7 +47,7 @@ public function testOfficialHolidays(): void 'stJohnsDay', ]; - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); if ($year >= Estonia::DECLARATION_OF_INDEPENDENCE_YEAR) { $holidays[] = 'independenceDay'; @@ -71,7 +71,7 @@ public function testOfficialHolidays(): void */ public function testObservedHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** @@ -81,7 +81,7 @@ public function testObservedHolidays(): void */ public function testSeasonalHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_SEASON); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_SEASON); } /** @@ -91,7 +91,7 @@ public function testSeasonalHolidays(): void */ public function testBankHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_BANK); } /** @@ -101,7 +101,7 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** diff --git a/tests/Estonia/GoodFridayDayTest.php b/tests/Estonia/GoodFridayDayTest.php index a8e4194b1..f859035da 100644 --- a/tests/Estonia/GoodFridayDayTest.php +++ b/tests/Estonia/GoodFridayDayTest.php @@ -37,21 +37,20 @@ class GoodFridayDayTest extends EstoniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomGoodFridayDates(self::TIMEZONE); + return static::generateRandomGoodFridayDates(self::TIMEZONE); } /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Suur Reede'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Estonia/IndependenceDayTest.php b/tests/Estonia/IndependenceDayTest.php index d3e8b8029..9b005ea0e 100644 --- a/tests/Estonia/IndependenceDayTest.php +++ b/tests/Estonia/IndependenceDayTest.php @@ -43,7 +43,7 @@ public function testHolidayBefore(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Estonia::DECLARATION_OF_INDEPENDENCE_YEAR - 1) + static::generateRandomYear(1000, Estonia::DECLARATION_OF_INDEPENDENCE_YEAR - 1) ); } @@ -54,7 +54,7 @@ public function testHolidayBefore(): void */ public function testHolidayAfter(): void { - $year = $this->generateRandomYear(Estonia::DECLARATION_OF_INDEPENDENCE_YEAR); + $year = static::generateRandomYear(Estonia::DECLARATION_OF_INDEPENDENCE_YEAR); $this->assertHoliday( self::REGION, @@ -72,13 +72,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Estonia::DECLARATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Estonia::DECLARATION_OF_INDEPENDENCE_YEAR), [self::LOCALE => 'Iseseisvuspäev'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Estonia::DECLARATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Estonia::DECLARATION_OF_INDEPENDENCE_YEAR), ['en' => 'Independence Day'] ); } @@ -91,7 +91,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Estonia::DECLARATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Estonia::DECLARATION_OF_INDEPENDENCE_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Estonia/InternationalWorkersDayTest.php b/tests/Estonia/InternationalWorkersDayTest.php index 15d157070..825dfbced 100644 --- a/tests/Estonia/InternationalWorkersDayTest.php +++ b/tests/Estonia/InternationalWorkersDayTest.php @@ -37,14 +37,12 @@ class InternationalWorkersDayTest extends EstoniaBaseTestCase implements Holiday * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Kevadpüha'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Estonia/NewYearsDayTest.php b/tests/Estonia/NewYearsDayTest.php index 68ab2884f..68299ce8c 100644 --- a/tests/Estonia/NewYearsDayTest.php +++ b/tests/Estonia/NewYearsDayTest.php @@ -37,14 +37,12 @@ class NewYearsDayTest extends EstoniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Uusaasta'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Estonia/PentecostTest.php b/tests/Estonia/PentecostTest.php index 49c8a2f01..1c5c4b4da 100644 --- a/tests/Estonia/PentecostTest.php +++ b/tests/Estonia/PentecostTest.php @@ -37,21 +37,20 @@ class PentecostTest extends EstoniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomPentecostDates(self::TIMEZONE); + return static::generateRandomPentecostDates(self::TIMEZONE); } /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nelipühade 1. püha'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Estonia/RestorationOfIndependenceDayTest.php b/tests/Estonia/RestorationOfIndependenceDayTest.php index 3583fe004..f5a92cf38 100644 --- a/tests/Estonia/RestorationOfIndependenceDayTest.php +++ b/tests/Estonia/RestorationOfIndependenceDayTest.php @@ -43,7 +43,7 @@ public function testHolidayBefore(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Estonia::RESTORATION_OF_INDEPENDENCE_YEAR - 1) + static::generateRandomYear(1000, Estonia::RESTORATION_OF_INDEPENDENCE_YEAR - 1) ); } @@ -54,7 +54,7 @@ public function testHolidayBefore(): void */ public function testHolidayAfter(): void { - $year = $this->generateRandomYear(Estonia::RESTORATION_OF_INDEPENDENCE_YEAR); + $year = static::generateRandomYear(Estonia::RESTORATION_OF_INDEPENDENCE_YEAR); $this->assertHoliday( self::REGION, @@ -72,13 +72,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Estonia::RESTORATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Estonia::RESTORATION_OF_INDEPENDENCE_YEAR), [self::LOCALE => 'Taasiseseisvumispäev'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Estonia::RESTORATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Estonia::RESTORATION_OF_INDEPENDENCE_YEAR), ['en' => 'Day of Restoration of Independence'] ); } @@ -91,7 +91,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Estonia::RESTORATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Estonia::RESTORATION_OF_INDEPENDENCE_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Estonia/SecondChristmasDayTest.php b/tests/Estonia/SecondChristmasDayTest.php index 4fbea249a..b53991963 100644 --- a/tests/Estonia/SecondChristmasDayTest.php +++ b/tests/Estonia/SecondChristmasDayTest.php @@ -37,14 +37,12 @@ class SecondChristmasDayTest extends EstoniaBaseTestCase implements HolidayTestC * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Teine Jõulupüha'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Estonia/StJohnsDayTest.php b/tests/Estonia/StJohnsDayTest.php index dd211c6a8..e01379c5e 100644 --- a/tests/Estonia/StJohnsDayTest.php +++ b/tests/Estonia/StJohnsDayTest.php @@ -37,14 +37,12 @@ class StJohnsDayTest extends EstoniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(6, 24, self::TIMEZONE); + return static::generateRandomDates(6, 24, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Jaanipäev'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Estonia/VictoryDayTest.php b/tests/Estonia/VictoryDayTest.php index 7c0d3adde..241630d9a 100644 --- a/tests/Estonia/VictoryDayTest.php +++ b/tests/Estonia/VictoryDayTest.php @@ -43,7 +43,7 @@ public function testHolidayBefore(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Estonia::VICTORY_DAY_START_YEAR - 1) + static::generateRandomYear(1000, Estonia::VICTORY_DAY_START_YEAR - 1) ); } @@ -54,7 +54,7 @@ public function testHolidayBefore(): void */ public function testHolidayAfter(): void { - $year = $this->generateRandomYear(Estonia::VICTORY_DAY_START_YEAR); + $year = static::generateRandomYear(Estonia::VICTORY_DAY_START_YEAR); $this->assertHoliday( self::REGION, @@ -72,13 +72,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Estonia::VICTORY_DAY_START_YEAR), + static::generateRandomYear(Estonia::VICTORY_DAY_START_YEAR), [self::LOCALE => 'Võidupüha'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Estonia::VICTORY_DAY_START_YEAR), + static::generateRandomYear(Estonia::VICTORY_DAY_START_YEAR), ['en' => 'Victory Day'] ); } @@ -91,7 +91,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Estonia::VICTORY_DAY_START_YEAR), + static::generateRandomYear(Estonia::VICTORY_DAY_START_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Finland/AllSaintsDayTest.php b/tests/Finland/AllSaintsDayTest.php index 6fae6c312..5d5135a5a 100644 --- a/tests/Finland/AllSaintsDayTest.php +++ b/tests/Finland/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends FinlandBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,12 +49,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE)); // Check between 31 October and 6th of November the day that is a Saturday @@ -81,7 +80,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pyhäinpäivä'] ); } @@ -93,6 +92,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Finland/AscensionDayTest.php b/tests/Finland/AscensionDayTest.php index 0cebce7d8..800d6cc17 100644 --- a/tests/Finland/AscensionDayTest.php +++ b/tests/Finland/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Helatorstai'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Finland/ChristmasDayTest.php b/tests/Finland/ChristmasDayTest.php index 9797e09b1..9e96dc1c7 100644 --- a/tests/Finland/ChristmasDayTest.php +++ b/tests/Finland/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends FinlandBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Joulupäivä'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Finland/EasterMondayTest.php b/tests/Finland/EasterMondayTest.php index 5ae7f4905..b7e83c8bd 100644 --- a/tests/Finland/EasterMondayTest.php +++ b/tests/Finland/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => '2. pääsiäispäivä'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Finland/EasterTest.php b/tests/Finland/EasterTest.php index 73600922f..c7341e2ad 100644 --- a/tests/Finland/EasterTest.php +++ b/tests/Finland/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pääsiäispäivä'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Finland/EpiphanyTest.php b/tests/Finland/EpiphanyTest.php index 9e5470015..8a66a09b8 100644 --- a/tests/Finland/EpiphanyTest.php +++ b/tests/Finland/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends FinlandBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Loppiainen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Finland/FinlandTest.php b/tests/Finland/FinlandTest.php index 161808261..36b695bf4 100644 --- a/tests/Finland/FinlandTest.php +++ b/tests/Finland/FinlandTest.php @@ -37,7 +37,7 @@ class FinlandTest extends FinlandBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1917); + $this->year = static::generateRandomYear(1917); } /** diff --git a/tests/Finland/GoodFridayTest.php b/tests/Finland/GoodFridayTest.php index 66f938aa9..0aec9d6ad 100644 --- a/tests/Finland/GoodFridayTest.php +++ b/tests/Finland/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pitkäperjantai'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Finland/IndependenceDayTest.php b/tests/Finland/IndependenceDayTest.php index 9b04ee79b..9a1b30a2e 100644 --- a/tests/Finland/IndependenceDayTest.php +++ b/tests/Finland/IndependenceDayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Itsenäisyyspäivä'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Finland/InternationalWorkersDayTest.php b/tests/Finland/InternationalWorkersDayTest.php index 79178cc5d..4e0bfa863 100644 --- a/tests/Finland/InternationalWorkersDayTest.php +++ b/tests/Finland/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends FinlandBaseTestCase implements Holiday /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vappu'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Finland/NewYearsDayTest.php b/tests/Finland/NewYearsDayTest.php index 94726db87..93a5572f3 100644 --- a/tests/Finland/NewYearsDayTest.php +++ b/tests/Finland/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends FinlandBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Uudenvuodenpäivä'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Finland/PentecostTest.php b/tests/Finland/PentecostTest.php index f40ba4979..4bd5cefe7 100644 --- a/tests/Finland/PentecostTest.php +++ b/tests/Finland/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Helluntaipäivä'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Finland/SecondChristmasDayTest.php b/tests/Finland/SecondChristmasDayTest.php index 97e969e80..7ba8010f3 100644 --- a/tests/Finland/SecondChristmasDayTest.php +++ b/tests/Finland/SecondChristmasDayTest.php @@ -33,11 +33,10 @@ class SecondChristmasDayTest extends FinlandBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => '2. joulupäivä'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Finland/stJohnsDayTest.php b/tests/Finland/stJohnsDayTest.php index 3ed75249c..193c94e67 100644 --- a/tests/Finland/stJohnsDayTest.php +++ b/tests/Finland/stJohnsDayTest.php @@ -62,14 +62,13 @@ public function testHolidayBeforeAdjustment(): void */ public function testHolidayAfterAdjustment(): void { - $year = $this->generateRandomYear(self::ADJUSTMENT_YEAR); + $year = static::generateRandomYear(self::ADJUSTMENT_YEAR); $holidays = Yasumi::create(self::REGION, $year); $holiday = $holidays->getHoliday(self::HOLIDAY); // Some basic assertions self::assertInstanceOf(Holiday::class, $holiday); - self::assertNotNull($holiday); // Holiday specific assertions self::assertEquals('Saturday', $holiday->format('l')); @@ -89,7 +88,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Juhannuspäivä'] ); } @@ -101,6 +100,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/France/AllSaintsDayTest.php b/tests/France/AllSaintsDayTest.php index a271b6803..bcb4be3d6 100644 --- a/tests/France/AllSaintsDayTest.php +++ b/tests/France/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends FranceBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Toussaint'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/France/ArmisticeDayTest.php b/tests/France/ArmisticeDayTest.php index 45e46bad6..211061788 100644 --- a/tests/France/ArmisticeDayTest.php +++ b/tests/France/ArmisticeDayTest.php @@ -42,7 +42,7 @@ class ArmisticeDayTest extends FranceBaseTestCase implements HolidayTestCase */ public function testArmisticeDayOnAfter1919(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testArmisticeDayBefore1919(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Armistice 1918'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/France/AscensionDayTest.php b/tests/France/AscensionDayTest.php index 4636deff4..1c99752fd 100644 --- a/tests/France/AscensionDayTest.php +++ b/tests/France/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ascension'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/France/AssumptionOfMaryTest.php b/tests/France/AssumptionOfMaryTest.php index c8a868643..4247ada37 100644 --- a/tests/France/AssumptionOfMaryTest.php +++ b/tests/France/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends FranceBaseTestCase implements HolidayTestCase /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Assomption'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/France/BasRhin/BasRhinTest.php b/tests/France/BasRhin/BasRhinTest.php index 698ae2c3a..516480430 100644 --- a/tests/France/BasRhin/BasRhinTest.php +++ b/tests/France/BasRhin/BasRhinTest.php @@ -38,7 +38,7 @@ class BasRhinTest extends BasRhinBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** diff --git a/tests/France/BasRhin/GoodFridayTest.php b/tests/France/BasRhin/GoodFridayTest.php index caccaa923..7ad5c66fa 100644 --- a/tests/France/BasRhin/GoodFridayTest.php +++ b/tests/France/BasRhin/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vendredi Saint'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/France/BasRhin/stStephensDayTest.php b/tests/France/BasRhin/stStephensDayTest.php index a98e7baf0..34fba8b6a 100644 --- a/tests/France/BasRhin/stStephensDayTest.php +++ b/tests/France/BasRhin/stStephensDayTest.php @@ -33,11 +33,10 @@ class stStephensDayTest extends BasRhinBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Saint-Étienne'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/France/BastilleDayTest.php b/tests/France/BastilleDayTest.php index eaa67cd89..f3dc677be 100644 --- a/tests/France/BastilleDayTest.php +++ b/tests/France/BastilleDayTest.php @@ -42,7 +42,7 @@ class BastilleDayTest extends FranceBaseTestCase implements HolidayTestCase */ public function testBastilleDayOnAfter1790(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testBastilleDayBefore1790(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'La Fête nationale'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/France/ChristmasDayTest.php b/tests/France/ChristmasDayTest.php index 206667cc4..d94613fd9 100644 --- a/tests/France/ChristmasDayTest.php +++ b/tests/France/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends FranceBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Noël'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/France/EasterMondayTest.php b/tests/France/EasterMondayTest.php index 1f1c5140d..369c26dc9 100644 --- a/tests/France/EasterMondayTest.php +++ b/tests/France/EasterMondayTest.php @@ -63,7 +63,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pâques'] ); } @@ -75,6 +75,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/France/FranceTest.php b/tests/France/FranceTest.php index a58736008..e21ab436f 100644 --- a/tests/France/FranceTest.php +++ b/tests/France/FranceTest.php @@ -38,7 +38,7 @@ class FranceTest extends FranceBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** diff --git a/tests/France/HautRhin/GoodFridayTest.php b/tests/France/HautRhin/GoodFridayTest.php index 214c24d7d..bb7c2fd23 100644 --- a/tests/France/HautRhin/GoodFridayTest.php +++ b/tests/France/HautRhin/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vendredi Saint'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/France/HautRhin/HautRhinTest.php b/tests/France/HautRhin/HautRhinTest.php index de19c9b87..53a273aa6 100644 --- a/tests/France/HautRhin/HautRhinTest.php +++ b/tests/France/HautRhin/HautRhinTest.php @@ -38,7 +38,7 @@ class HautRhinTest extends HautRhinBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** diff --git a/tests/France/HautRhin/stStephensDayTest.php b/tests/France/HautRhin/stStephensDayTest.php index 2c8b27c0a..2b86cecef 100644 --- a/tests/France/HautRhin/stStephensDayTest.php +++ b/tests/France/HautRhin/stStephensDayTest.php @@ -33,11 +33,10 @@ class stStephensDayTest extends HautRhinBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Saint-Étienne'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/France/InternationalWorkersDayTest.php b/tests/France/InternationalWorkersDayTest.php index 6b34a34c0..e91de006f 100644 --- a/tests/France/InternationalWorkersDayTest.php +++ b/tests/France/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends FranceBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fête du Travail'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/France/Moselle/GoodFridayTest.php b/tests/France/Moselle/GoodFridayTest.php index ca4717f3f..119d3ba23 100644 --- a/tests/France/Moselle/GoodFridayTest.php +++ b/tests/France/Moselle/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vendredi Saint'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/France/Moselle/MoselleTest.php b/tests/France/Moselle/MoselleTest.php index c04258f0d..f2e746602 100644 --- a/tests/France/Moselle/MoselleTest.php +++ b/tests/France/Moselle/MoselleTest.php @@ -38,7 +38,7 @@ class MoselleTest extends MoselleBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** diff --git a/tests/France/Moselle/stStephensDayTest.php b/tests/France/Moselle/stStephensDayTest.php index fc60a0a33..102819f9d 100644 --- a/tests/France/Moselle/stStephensDayTest.php +++ b/tests/France/Moselle/stStephensDayTest.php @@ -33,11 +33,10 @@ class stStephensDayTest extends MoselleBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Saint-Étienne'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/France/NewYearsDayTest.php b/tests/France/NewYearsDayTest.php index 331ab1298..6d40df078 100644 --- a/tests/France/NewYearsDayTest.php +++ b/tests/France/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends FranceBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Jour de l’An'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/France/PentecostMondayTest.php b/tests/France/PentecostMondayTest.php index 999f7781a..dbdcec793 100644 --- a/tests/France/PentecostMondayTest.php +++ b/tests/France/PentecostMondayTest.php @@ -57,7 +57,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pentecôte'] ); } @@ -72,14 +72,14 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(null, France::EST_YEAR_DAY_OF_SOLIDARITY_WITH_ELDERLY - 1), + static::generateRandomYear(null, France::EST_YEAR_DAY_OF_SOLIDARITY_WITH_ELDERLY - 1), Holiday::TYPE_OFFICIAL ); $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(France::EST_YEAR_DAY_OF_SOLIDARITY_WITH_ELDERLY), + static::generateRandomYear(France::EST_YEAR_DAY_OF_SOLIDARITY_WITH_ELDERLY), Holiday::TYPE_OBSERVANCE ); } diff --git a/tests/France/VictoryInEuropeDayTest.php b/tests/France/VictoryInEuropeDayTest.php index 87ac70b0b..d1e11e4a0 100644 --- a/tests/France/VictoryInEuropeDayTest.php +++ b/tests/France/VictoryInEuropeDayTest.php @@ -42,7 +42,7 @@ class VictoryInEuropeDayTest extends FranceBaseTestCase implements HolidayTestCa */ public function testVictoryInEuropeDayOnAfter1945(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testVictoryInEuropeDayBefore1945(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Victoire 1945'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Georgia/EasterTest.php b/tests/Georgia/EasterTest.php index 29fa4b14b..289fa027e 100644 --- a/tests/Georgia/EasterTest.php +++ b/tests/Georgia/EasterTest.php @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'აღდგომა'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Georgia/GeorgiaTest.php b/tests/Georgia/GeorgiaTest.php index b3d669b4c..aa5fb2fb7 100644 --- a/tests/Georgia/GeorgiaTest.php +++ b/tests/Georgia/GeorgiaTest.php @@ -40,7 +40,7 @@ class GeorgiaTest extends GeorgiaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(); + $this->year = static::generateRandomYear(); } /** diff --git a/tests/Georgia/InternationalWomensDayTest.php b/tests/Georgia/InternationalWomensDayTest.php index 2e3108b79..dcf8880b9 100644 --- a/tests/Georgia/InternationalWomensDayTest.php +++ b/tests/Georgia/InternationalWomensDayTest.php @@ -27,9 +27,7 @@ class InternationalWomensDayTest extends GeorgiaBaseTestCase implements HolidayT */ public const HOLIDAY = 'internationalWomensDay'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -42,9 +40,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(3, 8, self::TIMEZONE); + return static::generateRandomDates(3, 8, self::TIMEZONE); } /** @@ -57,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'ქალთა საერთაშორისო დღე'] ); } @@ -69,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Georgia/MtskhetobaDayTest.php b/tests/Georgia/MtskhetobaDayTest.php index 14f011342..fc1bcf4ae 100644 --- a/tests/Georgia/MtskhetobaDayTest.php +++ b/tests/Georgia/MtskhetobaDayTest.php @@ -27,9 +27,7 @@ class MtskhetobaDayTest extends GeorgiaBaseTestCase implements HolidayTestCase */ public const HOLIDAY = 'mtskhetobaDay'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -42,9 +40,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(10, 14, self::TIMEZONE); + return static::generateRandomDates(10, 14, self::TIMEZONE); } /** @@ -57,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'მცხეთობა'] ); } @@ -69,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Georgia/NewYearsDayTest.php b/tests/Georgia/NewYearsDayTest.php index 4bbf554a6..ea246567b 100644 --- a/tests/Georgia/NewYearsDayTest.php +++ b/tests/Georgia/NewYearsDayTest.php @@ -27,9 +27,7 @@ class NewYearsDayTest extends GeorgiaBaseTestCase implements HolidayTestCase */ public const HOLIDAY = 'newYearsDay'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -42,9 +40,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -57,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'ახალი წელი'] ); } @@ -69,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Georgia/OrthodoxChristmasDayTest.php b/tests/Georgia/OrthodoxChristmasDayTest.php index 768a9d950..d35b5a5bc 100644 --- a/tests/Georgia/OrthodoxChristmasDayTest.php +++ b/tests/Georgia/OrthodoxChristmasDayTest.php @@ -27,9 +27,7 @@ class OrthodoxChristmasDayTest extends GeorgiaBaseTestCase implements HolidayTes */ public const HOLIDAY = 'orthodoxChristmasDay'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -42,9 +40,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 7, self::TIMEZONE); + return static::generateRandomDates(1, 7, self::TIMEZONE); } /** @@ -57,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'ქრისტეს შობა'] ); } @@ -69,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Georgia/OrthodoxEpiphanyDayTest.php b/tests/Georgia/OrthodoxEpiphanyDayTest.php index 10a583568..3d605c8e3 100644 --- a/tests/Georgia/OrthodoxEpiphanyDayTest.php +++ b/tests/Georgia/OrthodoxEpiphanyDayTest.php @@ -27,9 +27,7 @@ class OrthodoxEpiphanyDayTest extends GeorgiaBaseTestCase implements HolidayTest */ public const HOLIDAY = 'orthodoxEpiphanyDay'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -42,9 +40,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 19, self::TIMEZONE); + return static::generateRandomDates(1, 19, self::TIMEZONE); } /** @@ -57,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'ნათლისღება'] ); } @@ -69,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Georgia/SecondNewYearDayTest.php b/tests/Georgia/SecondNewYearDayTest.php index 9106ef720..c0b30ecd7 100644 --- a/tests/Georgia/SecondNewYearDayTest.php +++ b/tests/Georgia/SecondNewYearDayTest.php @@ -27,9 +27,7 @@ class SecondNewYearDayTest extends GeorgiaBaseTestCase implements HolidayTestCas */ public const HOLIDAY = 'secondDayOfNewYear'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -42,9 +40,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 2, self::TIMEZONE); + return static::generateRandomDates(1, 2, self::TIMEZONE); } /** @@ -57,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'ბედობა'] ); } @@ -69,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Georgia/StAndrewsDayTest.php b/tests/Georgia/StAndrewsDayTest.php index beb78f41b..40bd100de 100644 --- a/tests/Georgia/StAndrewsDayTest.php +++ b/tests/Georgia/StAndrewsDayTest.php @@ -27,9 +27,7 @@ class StAndrewsDayTest extends GeorgiaBaseTestCase implements HolidayTestCase */ public const HOLIDAY = 'stAndrewsDay'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -42,9 +40,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 12, self::TIMEZONE); + return static::generateRandomDates(5, 12, self::TIMEZONE); } /** @@ -57,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'წმინდა ანდრია პირველწოდებულის ხსენების დღე'] ); } @@ -69,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Georgia/StGeorgesDayTest.php b/tests/Georgia/StGeorgesDayTest.php index f2707e4b8..fa5b45211 100644 --- a/tests/Georgia/StGeorgesDayTest.php +++ b/tests/Georgia/StGeorgesDayTest.php @@ -27,9 +27,7 @@ class StGeorgesDayTest extends GeorgiaBaseTestCase implements HolidayTestCase */ public const HOLIDAY = 'stGeorgesDay'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -42,9 +40,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 23, self::TIMEZONE); + return static::generateRandomDates(11, 23, self::TIMEZONE); } /** @@ -57,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'გიორგობა'] ); } @@ -69,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Georgia/StMarysDayTest.php b/tests/Georgia/StMarysDayTest.php index 84bf4bfb9..dbb5c0f1e 100644 --- a/tests/Georgia/StMarysDayTest.php +++ b/tests/Georgia/StMarysDayTest.php @@ -27,9 +27,7 @@ class StMarysDayTest extends GeorgiaBaseTestCase implements HolidayTestCase */ public const HOLIDAY = 'stMarysDay'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -42,9 +40,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 28, self::TIMEZONE); + return static::generateRandomDates(8, 28, self::TIMEZONE); } /** @@ -57,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'მარიამობა'] ); } @@ -69,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Georgia/VictoryDayTest.php b/tests/Georgia/VictoryDayTest.php index 926b99515..1afb03494 100644 --- a/tests/Georgia/VictoryDayTest.php +++ b/tests/Georgia/VictoryDayTest.php @@ -27,9 +27,7 @@ class VictoryDayTest extends GeorgiaBaseTestCase implements HolidayTestCase */ public const HOLIDAY = 'victoryDay'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -42,9 +40,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 9, self::TIMEZONE); + return static::generateRandomDates(5, 9, self::TIMEZONE); } /** @@ -57,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'ფაშიზმზე გამარჯვების დღე'] ); } @@ -69,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/AscensionDayTest.php b/tests/Germany/AscensionDayTest.php index c69263a5a..eadeb8f9c 100644 --- a/tests/Germany/AscensionDayTest.php +++ b/tests/Germany/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christi Himmelfahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/BadenWurttemberg/AllSaintsDayTest.php b/tests/Germany/BadenWurttemberg/AllSaintsDayTest.php index 47807afa1..8770385bf 100644 --- a/tests/Germany/BadenWurttemberg/AllSaintsDayTest.php +++ b/tests/Germany/BadenWurttemberg/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends BadenWurttembergBaseTestCase implements HolidayTe /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/BadenWurttemberg/BadenWurttembergTest.php b/tests/Germany/BadenWurttemberg/BadenWurttembergTest.php index fa0995d2c..b2064c88a 100644 --- a/tests/Germany/BadenWurttemberg/BadenWurttembergTest.php +++ b/tests/Germany/BadenWurttemberg/BadenWurttembergTest.php @@ -37,7 +37,7 @@ class BadenWurttembergTest extends BadenWurttembergBaseTestCase implements Provi */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -91,7 +91,10 @@ public function testBankHolidays(): void public function testOtherHolidays(): void { $this->assertDefinedHolidays( - [], + [ + 'pentecost', + 'newYearsEve', + ], self::REGION, $this->year, Holiday::TYPE_OTHER diff --git a/tests/Germany/BadenWurttemberg/CorpusChristiTest.php b/tests/Germany/BadenWurttemberg/CorpusChristiTest.php index e09a78eaa..75865e708 100644 --- a/tests/Germany/BadenWurttemberg/CorpusChristiTest.php +++ b/tests/Germany/BadenWurttemberg/CorpusChristiTest.php @@ -37,13 +37,13 @@ class CorpusChristiTest extends BadenWurttembergBaseTestCase implements HolidayT */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -57,7 +57,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -69,6 +69,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/BadenWurttemberg/EpiphanyTest.php b/tests/Germany/BadenWurttemberg/EpiphanyTest.php index 86bc2df68..ed3e3cf87 100644 --- a/tests/Germany/BadenWurttemberg/EpiphanyTest.php +++ b/tests/Germany/BadenWurttemberg/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends BadenWurttembergBaseTestCase implements HolidayTestCa /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Heilige 3 Könige'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/Bavaria/AllSaintsDayTest.php b/tests/Germany/Bavaria/AllSaintsDayTest.php index f69d8d97a..01fe4c67f 100644 --- a/tests/Germany/Bavaria/AllSaintsDayTest.php +++ b/tests/Germany/Bavaria/AllSaintsDayTest.php @@ -33,11 +33,11 @@ class AllSaintsDayTest extends BavariaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +50,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +65,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -77,6 +77,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/Bavaria/AssumptionOfMaryTest.php b/tests/Germany/Bavaria/AssumptionOfMaryTest.php index 60f0a3182..f53eceacf 100644 --- a/tests/Germany/Bavaria/AssumptionOfMaryTest.php +++ b/tests/Germany/Bavaria/AssumptionOfMaryTest.php @@ -33,11 +33,11 @@ class AssumptionOfMaryTest extends BavariaBaseTestCase implements HolidayTestCas /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +50,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +65,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Himmelfahrt'] ); } @@ -77,6 +77,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Germany/Bavaria/BavariaTest.php b/tests/Germany/Bavaria/BavariaTest.php index 43043258c..3d6656fea 100644 --- a/tests/Germany/Bavaria/BavariaTest.php +++ b/tests/Germany/Bavaria/BavariaTest.php @@ -37,7 +37,7 @@ class BavariaTest extends BavariaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -91,7 +91,11 @@ public function testBankHolidays(): void public function testOtherHolidays(): void { $this->assertDefinedHolidays( - [], + [ + 'pentecost', + 'assumptionOfMary', + 'newYearsEve', + ], self::REGION, $this->year, Holiday::TYPE_OTHER diff --git a/tests/Germany/Bavaria/CorpusChristiTest.php b/tests/Germany/Bavaria/CorpusChristiTest.php index 5b9b8f19d..8d00cdf35 100644 --- a/tests/Germany/Bavaria/CorpusChristiTest.php +++ b/tests/Germany/Bavaria/CorpusChristiTest.php @@ -37,13 +37,13 @@ class CorpusChristiTest extends BavariaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -57,7 +57,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -69,6 +69,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/Bavaria/EpiphanyTest.php b/tests/Germany/Bavaria/EpiphanyTest.php index c1848030a..ce05cc339 100644 --- a/tests/Germany/Bavaria/EpiphanyTest.php +++ b/tests/Germany/Bavaria/EpiphanyTest.php @@ -33,11 +33,11 @@ class EpiphanyTest extends BavariaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +50,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +65,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Heilige 3 Könige'] ); } @@ -77,6 +77,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/Berlin/BerlinTest.php b/tests/Germany/Berlin/BerlinTest.php index 0e09b2020..9b34fe3d5 100644 --- a/tests/Germany/Berlin/BerlinTest.php +++ b/tests/Germany/Berlin/BerlinTest.php @@ -37,7 +37,7 @@ class BerlinTest extends BerlinBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -87,7 +87,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/Berlin/DayOfLiberationTest.php b/tests/Germany/Berlin/DayOfLiberationTest.php index 05d51d426..4ded74e89 100644 --- a/tests/Germany/Berlin/DayOfLiberationTest.php +++ b/tests/Germany/Berlin/DayOfLiberationTest.php @@ -64,7 +64,7 @@ public function testHolidayBeforeYear(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, current(self::$years) - 1) + static::generateRandomYear(1000, current(self::$years) - 1) ); } @@ -80,7 +80,7 @@ public function testHolidayAfterYear(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(current(self::$years) + 1) + static::generateRandomYear(current(self::$years) + 1) ); } diff --git a/tests/Germany/Berlin/InternationalWomensDay2019Test.php b/tests/Germany/Berlin/InternationalWomensDay2019Test.php index a2c6a0c15..e9e0ff3c0 100644 --- a/tests/Germany/Berlin/InternationalWomensDay2019Test.php +++ b/tests/Germany/Berlin/InternationalWomensDay2019Test.php @@ -60,7 +60,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -71,7 +71,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testHolidayAfterCompletion(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(1900, self::ESTABLISHMENT_YEAR - 1)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(1900, self::ESTABLISHMENT_YEAR - 1)); } /** @@ -84,7 +84,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Internationaler Frauentag'] ); } @@ -99,7 +99,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/Brandenburg/BrandenburgTest.php b/tests/Germany/Brandenburg/BrandenburgTest.php index 7e36501e4..2603e60f7 100644 --- a/tests/Germany/Brandenburg/BrandenburgTest.php +++ b/tests/Germany/Brandenburg/BrandenburgTest.php @@ -37,7 +37,7 @@ class BrandenburgTest extends BrandenburgBaseTestCase implements ProviderTestCas */ protected function setUp(): void { - $this->year = $this->generateRandomYear(); + $this->year = static::generateRandomYear(); } /** @@ -98,7 +98,14 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/Brandenburg/ReformationDayTest.php b/tests/Germany/Brandenburg/ReformationDayTest.php index 97907fb8d..e638bf42b 100644 --- a/tests/Germany/Brandenburg/ReformationDayTest.php +++ b/tests/Germany/Brandenburg/ReformationDayTest.php @@ -38,11 +38,10 @@ class ReformationDayTest extends BrandenburgBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Reformationstag'] ); } @@ -106,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/Bremen/BremenTest.php b/tests/Germany/Bremen/BremenTest.php index 816094fbe..d1118a0bb 100644 --- a/tests/Germany/Bremen/BremenTest.php +++ b/tests/Germany/Bremen/BremenTest.php @@ -37,7 +37,7 @@ class BremenTest extends BremenBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -87,7 +87,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/Bremen/ReformationDayTest.php b/tests/Germany/Bremen/ReformationDayTest.php index a6bde4ea3..9a67e2bd2 100644 --- a/tests/Germany/Bremen/ReformationDayTest.php +++ b/tests/Germany/Bremen/ReformationDayTest.php @@ -38,11 +38,10 @@ class ReformationDayTest extends BremenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Reformationstag'] ); } @@ -106,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/ChristmasTest.php b/tests/Germany/ChristmasTest.php index b183f0ca5..4459c29a1 100644 --- a/tests/Germany/ChristmasTest.php +++ b/tests/Germany/ChristmasTest.php @@ -33,11 +33,10 @@ class ChristmasTest extends GermanyBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => '1. Weihnachtsfeiertag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/EasterMondayTest.php b/tests/Germany/EasterMondayTest.php index 23d9078f9..7bc9b1a2c 100644 --- a/tests/Germany/EasterMondayTest.php +++ b/tests/Germany/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/GermanUnityDayTest.php b/tests/Germany/GermanUnityDayTest.php index 5a77a7a72..940e02e4a 100644 --- a/tests/Germany/GermanUnityDayTest.php +++ b/tests/Germany/GermanUnityDayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2080), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2080), [self::LOCALE => 'Tag der Deutschen Einheit'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/GermanyTest.php b/tests/Germany/GermanyTest.php index a18ae286f..429d8c53d 100644 --- a/tests/Germany/GermanyTest.php +++ b/tests/Germany/GermanyTest.php @@ -37,7 +37,7 @@ class GermanyTest extends GermanyBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** diff --git a/tests/Germany/GoodFridayTest.php b/tests/Germany/GoodFridayTest.php index a07aa1b5e..bd3e95dcc 100644 --- a/tests/Germany/GoodFridayTest.php +++ b/tests/Germany/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/Hamburg/DayOfReformationTest.php b/tests/Germany/Hamburg/DayOfReformationTest.php index dd1c420a4..c5a194919 100644 --- a/tests/Germany/Hamburg/DayOfReformationTest.php +++ b/tests/Germany/Hamburg/DayOfReformationTest.php @@ -38,11 +38,10 @@ class DayOfReformationTest extends HamburgBaseTestCase implements HolidayTestCas /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Tag der Reformation'] ); } @@ -106,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/Hamburg/GermanUnityDay.php b/tests/Germany/Hamburg/GermanUnityDay.php index aa3028dcc..e5b37175a 100644 --- a/tests/Germany/Hamburg/GermanUnityDay.php +++ b/tests/Germany/Hamburg/GermanUnityDay.php @@ -24,4 +24,8 @@ */ class GermanUnityDay extends BaseGermanUnityDayTest { + public function __construct() + { + parent::__construct(static::class); + } } diff --git a/tests/Germany/Hamburg/HamburgTest.php b/tests/Germany/Hamburg/HamburgTest.php index 9a2cad636..cead26a00 100644 --- a/tests/Germany/Hamburg/HamburgTest.php +++ b/tests/Germany/Hamburg/HamburgTest.php @@ -37,7 +37,7 @@ class HamburgTest extends HamburgBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -87,7 +87,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/Hesse/CorpusChristiTest.php b/tests/Germany/Hesse/CorpusChristiTest.php index 183dce36d..cadf5ba0e 100644 --- a/tests/Germany/Hesse/CorpusChristiTest.php +++ b/tests/Germany/Hesse/CorpusChristiTest.php @@ -37,13 +37,13 @@ class CorpusChristiTest extends HesseBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -57,7 +57,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -69,6 +69,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/Hesse/HesseTest.php b/tests/Germany/Hesse/HesseTest.php index fda894703..cfdcdf37e 100644 --- a/tests/Germany/Hesse/HesseTest.php +++ b/tests/Germany/Hesse/HesseTest.php @@ -37,7 +37,7 @@ class HesseTest extends HesseBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -88,7 +88,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/InternationalWorkersDayTest.php b/tests/Germany/InternationalWorkersDayTest.php index 705cf9565..2df5b3ef8 100644 --- a/tests/Germany/InternationalWorkersDayTest.php +++ b/tests/Germany/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends GermanyBaseTestCase implements Holiday /** * Tests International Workers' Day. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which International Workers' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Tag der Arbeit'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Germany/LowerSaxony/LowerSaxonyTest.php b/tests/Germany/LowerSaxony/LowerSaxonyTest.php index 53c77f095..3cd7eff6e 100644 --- a/tests/Germany/LowerSaxony/LowerSaxonyTest.php +++ b/tests/Germany/LowerSaxony/LowerSaxonyTest.php @@ -37,7 +37,7 @@ class LowerSaxonyTest extends LowerSaxonyBaseTestCase implements ProviderTestCas */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -87,7 +87,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/LowerSaxony/ReformationDayTest.php b/tests/Germany/LowerSaxony/ReformationDayTest.php index 1846bf6e2..28b998ca7 100644 --- a/tests/Germany/LowerSaxony/ReformationDayTest.php +++ b/tests/Germany/LowerSaxony/ReformationDayTest.php @@ -38,11 +38,10 @@ class ReformationDayTest extends LowerSaxonyBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Reformationstag'] ); } @@ -106,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/MecklenburgWesternPomerania/InternationalWomensDayTest.php b/tests/Germany/MecklenburgWesternPomerania/InternationalWomensDayTest.php index a155d167f..dc3f03049 100644 --- a/tests/Germany/MecklenburgWesternPomerania/InternationalWomensDayTest.php +++ b/tests/Germany/MecklenburgWesternPomerania/InternationalWomensDayTest.php @@ -60,7 +60,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -71,7 +71,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testHolidayAfterCompletion(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(1900, self::ESTABLISHMENT_YEAR - 1)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(1900, self::ESTABLISHMENT_YEAR - 1)); } /** @@ -84,7 +84,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Internationaler Frauentag'] ); } @@ -99,7 +99,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaTest.php b/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaTest.php index 2ee6c9490..3a02a63a6 100644 --- a/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaTest.php +++ b/tests/Germany/MecklenburgWesternPomerania/MecklenburgWesternPomeraniaTest.php @@ -37,7 +37,7 @@ class MecklenburgWesternPomeraniaTest extends MecklenburgWesternPomeraniaBaseTes */ protected function setUp(): void { - $this->year = $this->generateRandomYear(); + $this->year = static::generateRandomYear(); } /** @@ -96,7 +96,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/MecklenburgWesternPomerania/ReformationDayTest.php b/tests/Germany/MecklenburgWesternPomerania/ReformationDayTest.php index fc5278541..9d67a4df7 100644 --- a/tests/Germany/MecklenburgWesternPomerania/ReformationDayTest.php +++ b/tests/Germany/MecklenburgWesternPomerania/ReformationDayTest.php @@ -42,12 +42,12 @@ class ReformationDayTest extends MecklenburgWesternPomeraniaBaseTestCase impleme * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE))]; } @@ -64,7 +64,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -78,7 +78,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Reformationstag'] ); } @@ -93,7 +93,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/NewYearsDayTest.php b/tests/Germany/NewYearsDayTest.php index e86b087c7..951d5545c 100644 --- a/tests/Germany/NewYearsDayTest.php +++ b/tests/Germany/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends GermanyBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/NewYearsEveTest.php b/tests/Germany/NewYearsEveTest.php index ca522097a..6fe785e4d 100644 --- a/tests/Germany/NewYearsEveTest.php +++ b/tests/Germany/NewYearsEveTest.php @@ -33,11 +33,10 @@ class NewYearsEveTest extends GermanyBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 31, self::TIMEZONE); + return static::generateRandomDates(12, 31, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Silvester'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Germany/NorthRhineWestphalia/AllSaintsDayTest.php b/tests/Germany/NorthRhineWestphalia/AllSaintsDayTest.php index caa5d1de3..758d13edb 100644 --- a/tests/Germany/NorthRhineWestphalia/AllSaintsDayTest.php +++ b/tests/Germany/NorthRhineWestphalia/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends NorthRhineWestphaliaBaseTestCase implements Holid /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/NorthRhineWestphalia/CorpusChristiTest.php b/tests/Germany/NorthRhineWestphalia/CorpusChristiTest.php index c21cc21d5..fba2615e3 100644 --- a/tests/Germany/NorthRhineWestphalia/CorpusChristiTest.php +++ b/tests/Germany/NorthRhineWestphalia/CorpusChristiTest.php @@ -37,13 +37,13 @@ class CorpusChristiTest extends NorthRhineWestphaliaBaseTestCase implements Holi */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -57,7 +57,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -69,6 +69,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaTest.php b/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaTest.php index 74bf7ffae..350b4bf60 100644 --- a/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaTest.php +++ b/tests/Germany/NorthRhineWestphalia/NorthRhineWestphaliaTest.php @@ -37,7 +37,7 @@ class NorthRhineWestphaliaTest extends NorthRhineWestphaliaBaseTestCase implemen */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -89,7 +89,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/PentecostMondayTest.php b/tests/Germany/PentecostMondayTest.php index 04becece3..7bf7cee1c 100644 --- a/tests/Germany/PentecostMondayTest.php +++ b/tests/Germany/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/PentecostTest.php b/tests/Germany/PentecostTest.php index 603eda0eb..c8d8d2a23 100644 --- a/tests/Germany/PentecostTest.php +++ b/tests/Germany/PentecostTest.php @@ -37,7 +37,7 @@ class PentecostTest extends GermanyBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $time_stamp = strtotime( $year . '-03-21' . easter_days($year) . ' day + 49 day' ); @@ -61,7 +61,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstsonntag'] ); } @@ -73,6 +73,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Germany/ReformationDay2017Test.php b/tests/Germany/ReformationDay2017Test.php index feb96111f..96a9f63a8 100644 --- a/tests/Germany/ReformationDay2017Test.php +++ b/tests/Germany/ReformationDay2017Test.php @@ -60,7 +60,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -71,7 +71,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testHolidayAfterCompletion(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR + 1)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR + 1)); } /** @@ -84,7 +84,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Reformationstag'] ); } @@ -99,7 +99,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/RhinelandPalatinate/AllSaintsDayTest.php b/tests/Germany/RhinelandPalatinate/AllSaintsDayTest.php index 36522b85e..8c409266b 100644 --- a/tests/Germany/RhinelandPalatinate/AllSaintsDayTest.php +++ b/tests/Germany/RhinelandPalatinate/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends RhinelandPalatinateBaseTestCase implements Holida /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/RhinelandPalatinate/CorpusChristiTest.php b/tests/Germany/RhinelandPalatinate/CorpusChristiTest.php index dbadd0f25..accecaaaa 100644 --- a/tests/Germany/RhinelandPalatinate/CorpusChristiTest.php +++ b/tests/Germany/RhinelandPalatinate/CorpusChristiTest.php @@ -37,13 +37,13 @@ class CorpusChristiTest extends RhinelandPalatinateBaseTestCase implements Holid */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -57,7 +57,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -69,6 +69,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/RhinelandPalatinate/RhinelandPalatinateTest.php b/tests/Germany/RhinelandPalatinate/RhinelandPalatinateTest.php index a92eb185d..1c8d55cb4 100644 --- a/tests/Germany/RhinelandPalatinate/RhinelandPalatinateTest.php +++ b/tests/Germany/RhinelandPalatinate/RhinelandPalatinateTest.php @@ -37,7 +37,7 @@ class RhinelandPalatinateTest extends RhinelandPalatinateBaseTestCase implements */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -89,7 +89,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/Saarland/AllSaintsDayTest.php b/tests/Germany/Saarland/AllSaintsDayTest.php index f5b00b745..95a28dda2 100644 --- a/tests/Germany/Saarland/AllSaintsDayTest.php +++ b/tests/Germany/Saarland/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends SaarlandBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/Saarland/AssumptionOfMaryTest.php b/tests/Germany/Saarland/AssumptionOfMaryTest.php index 77e7c1d32..e00ca9ea0 100644 --- a/tests/Germany/Saarland/AssumptionOfMaryTest.php +++ b/tests/Germany/Saarland/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends SaarlandBaseTestCase implements HolidayTestCa /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Himmelfahrt'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Germany/Saarland/CorpusChristiTest.php b/tests/Germany/Saarland/CorpusChristiTest.php index be36711f3..756faeae4 100644 --- a/tests/Germany/Saarland/CorpusChristiTest.php +++ b/tests/Germany/Saarland/CorpusChristiTest.php @@ -37,13 +37,13 @@ class CorpusChristiTest extends SaarlandBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -57,7 +57,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -69,6 +69,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/Saarland/SaarlandTest.php b/tests/Germany/Saarland/SaarlandTest.php index 6523417dd..74fc6faa2 100644 --- a/tests/Germany/Saarland/SaarlandTest.php +++ b/tests/Germany/Saarland/SaarlandTest.php @@ -37,7 +37,7 @@ class SaarlandTest extends SaarlandBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** diff --git a/tests/Germany/Saxony/ReformationDayTest.php b/tests/Germany/Saxony/ReformationDayTest.php index c63635d63..d0fd24e30 100644 --- a/tests/Germany/Saxony/ReformationDayTest.php +++ b/tests/Germany/Saxony/ReformationDayTest.php @@ -38,11 +38,10 @@ class ReformationDayTest extends SaxonyBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Reformationstag'] ); } @@ -106,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/Saxony/RepentanceAndPrayerDayTest.php b/tests/Germany/Saxony/RepentanceAndPrayerDayTest.php index 216158ba0..96ba5fa46 100644 --- a/tests/Germany/Saxony/RepentanceAndPrayerDayTest.php +++ b/tests/Germany/Saxony/RepentanceAndPrayerDayTest.php @@ -48,7 +48,7 @@ class RepentanceAndPrayerDayTest extends SaxonyBaseTestCase implements HolidayTe public function testHolidayOnAfterEstablishment(): void { // Check between the 16th and 22nd day the one that is a Wednesday - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $holiday = new \DateTime("next wednesday {$year}-11-15", new \DateTimeZone(self::TIMEZONE)); // Default date $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $holiday); @@ -69,7 +69,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -83,7 +83,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Buß- und Bettag'] ); } @@ -98,7 +98,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/Saxony/SaxonyTest.php b/tests/Germany/Saxony/SaxonyTest.php index 9b71838d0..5fcb2abe9 100644 --- a/tests/Germany/Saxony/SaxonyTest.php +++ b/tests/Germany/Saxony/SaxonyTest.php @@ -37,7 +37,7 @@ class SaxonyTest extends SaxonyBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -100,7 +100,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/SaxonyAnhalt/EpiphanyTest.php b/tests/Germany/SaxonyAnhalt/EpiphanyTest.php index a281c4624..c115ce684 100644 --- a/tests/Germany/SaxonyAnhalt/EpiphanyTest.php +++ b/tests/Germany/SaxonyAnhalt/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends SaxonyAnhaltBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Heilige 3 Könige'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/SaxonyAnhalt/ReformationDayTest.php b/tests/Germany/SaxonyAnhalt/ReformationDayTest.php index 2fed59b37..adf9c59db 100644 --- a/tests/Germany/SaxonyAnhalt/ReformationDayTest.php +++ b/tests/Germany/SaxonyAnhalt/ReformationDayTest.php @@ -38,11 +38,10 @@ class ReformationDayTest extends SaxonyAnhaltBaseTestCase implements HolidayTest /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Reformationstag'] ); } @@ -106,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/SaxonyAnhalt/SaxonyAnhaltTest.php b/tests/Germany/SaxonyAnhalt/SaxonyAnhaltTest.php index a3ef75161..dabd70b5f 100644 --- a/tests/Germany/SaxonyAnhalt/SaxonyAnhaltTest.php +++ b/tests/Germany/SaxonyAnhalt/SaxonyAnhaltTest.php @@ -37,7 +37,7 @@ class SaxonyAnhaltTest extends SaxonyAnhaltBaseTestCase implements ProviderTestC */ protected function setUp(): void { - $this->year = $this->generateRandomYear(); + $this->year = static::generateRandomYear(); } /** @@ -97,7 +97,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/SchleswigHolstein/ReformationDayTest.php b/tests/Germany/SchleswigHolstein/ReformationDayTest.php index 9103bc6b2..97f75cb8b 100644 --- a/tests/Germany/SchleswigHolstein/ReformationDayTest.php +++ b/tests/Germany/SchleswigHolstein/ReformationDayTest.php @@ -38,11 +38,10 @@ class ReformationDayTest extends SchleswigHolsteinBaseTestCase implements Holida /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 2) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Reformationstag'] ); } @@ -106,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/SchleswigHolstein/SchleswigHolsteinTest.php b/tests/Germany/SchleswigHolstein/SchleswigHolsteinTest.php index b43be8192..e3b62bddf 100644 --- a/tests/Germany/SchleswigHolstein/SchleswigHolsteinTest.php +++ b/tests/Germany/SchleswigHolstein/SchleswigHolsteinTest.php @@ -37,7 +37,7 @@ class SchleswigHolsteinTest extends SchleswigHolsteinBaseTestCase implements Pro */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1990); + $this->year = static::generateRandomYear(1990); } /** @@ -87,7 +87,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/SecondChristmasDayTest.php b/tests/Germany/SecondChristmasDayTest.php index f3b60d594..0051d4063 100644 --- a/tests/Germany/SecondChristmasDayTest.php +++ b/tests/Germany/SecondChristmasDayTest.php @@ -33,11 +33,10 @@ class SecondChristmasDayTest extends GermanyBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => '2. Weihnachtsfeiertag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Germany/Thuringia/ReformationDayTest.php b/tests/Germany/Thuringia/ReformationDayTest.php index b1acece20..0a4a3afd5 100644 --- a/tests/Germany/Thuringia/ReformationDayTest.php +++ b/tests/Germany/Thuringia/ReformationDayTest.php @@ -38,11 +38,10 @@ class ReformationDayTest extends ThuringiaBaseTestCase implements HolidayTestCas /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Reformationstag'] ); } @@ -106,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Germany/Thuringia/ThuringiaTest.php b/tests/Germany/Thuringia/ThuringiaTest.php index fd8058220..220334520 100644 --- a/tests/Germany/Thuringia/ThuringiaTest.php +++ b/tests/Germany/Thuringia/ThuringiaTest.php @@ -37,7 +37,7 @@ class ThuringiaTest extends ThuringiaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(); + $this->year = static::generateRandomYear(); } /** @@ -100,7 +100,15 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'pentecost', + 'newYearsEve', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Germany/Thuringia/WorldChildrensDayTest.php b/tests/Germany/Thuringia/WorldChildrensDayTest.php index 6c1183bd2..db9cb6c72 100644 --- a/tests/Germany/Thuringia/WorldChildrensDayTest.php +++ b/tests/Germany/Thuringia/WorldChildrensDayTest.php @@ -38,11 +38,10 @@ class WorldChildrensDayTest extends ThuringiaBaseTestCase implements HolidayTest /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -55,12 +54,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $data[] = [$year, new \DateTime("{$year}-09-20", new \DateTimeZone(self::TIMEZONE))]; } @@ -77,7 +76,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Weltkindertag'] ); } @@ -106,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Greece/AnnunciationTest.php b/tests/Greece/AnnunciationTest.php index 85827d8ff..0e12984bd 100644 --- a/tests/Greece/AnnunciationTest.php +++ b/tests/Greece/AnnunciationTest.php @@ -33,11 +33,10 @@ class AnnunciationTest extends GreeceBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(3, 25, self::TIMEZONE); + return static::generateRandomDates(3, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ευαγγελισμός της Θεοτόκου'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Greece/AscensionDayTest.php b/tests/Greece/AscensionDayTest.php index 6b2ada329..6bd34a5f1 100644 --- a/tests/Greece/AscensionDayTest.php +++ b/tests/Greece/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ανάληψη του Χριστού'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Greece/AssumptionOfMaryTest.php b/tests/Greece/AssumptionOfMaryTest.php index 6d99598f0..c684239dc 100644 --- a/tests/Greece/AssumptionOfMaryTest.php +++ b/tests/Greece/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends GreeceBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Κοίμηση της Θεοτόκου'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Greece/ChristmasDayTest.php b/tests/Greece/ChristmasDayTest.php index 7896675c7..63d6841f5 100644 --- a/tests/Greece/ChristmasDayTest.php +++ b/tests/Greece/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends GreeceBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Χριστούγεννα'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Greece/CleanMondayTest.php b/tests/Greece/CleanMondayTest.php index ca61f8a52..46af7e46c 100644 --- a/tests/Greece/CleanMondayTest.php +++ b/tests/Greece/CleanMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Καθαρά Δευτέρα'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Greece/EasterMondayTest.php b/tests/Greece/EasterMondayTest.php index e076f8e36..69c0a725f 100644 --- a/tests/Greece/EasterMondayTest.php +++ b/tests/Greece/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Δευτέρα του Πάσχα'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Greece/EasterTest.php b/tests/Greece/EasterTest.php index 8f201fb7e..a6f0aca89 100644 --- a/tests/Greece/EasterTest.php +++ b/tests/Greece/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Κυριακή του Πάσχα'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Greece/EpiphanyTest.php b/tests/Greece/EpiphanyTest.php index 3fb172223..5f5ce3d7c 100644 --- a/tests/Greece/EpiphanyTest.php +++ b/tests/Greece/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends GreeceBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Θεοφάνεια'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Greece/GreeceTest.php b/tests/Greece/GreeceTest.php index bb5bf8271..ac9d4ae8e 100644 --- a/tests/Greece/GreeceTest.php +++ b/tests/Greece/GreeceTest.php @@ -37,7 +37,7 @@ class GreeceTest extends GreeceBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1985); + $this->year = static::generateRandomYear(1985); } /** diff --git a/tests/Greece/IndependenceDayTest.php b/tests/Greece/IndependenceDayTest.php index bc78e7a06..f197bf4c6 100644 --- a/tests/Greece/IndependenceDayTest.php +++ b/tests/Greece/IndependenceDayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Εικοστή Πέμπτη Μαρτίου'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Greece/InternationalWorkersDayTest.php b/tests/Greece/InternationalWorkersDayTest.php index 4e48c00ec..5cd4bf03a 100644 --- a/tests/Greece/InternationalWorkersDayTest.php +++ b/tests/Greece/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends GreeceBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Εργατική Πρωτομαγιά'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Greece/NewYearsDayTest.php b/tests/Greece/NewYearsDayTest.php index 8c783055d..764c25162 100644 --- a/tests/Greece/NewYearsDayTest.php +++ b/tests/Greece/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends GreeceBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Πρωτοχρονιά'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Greece/OhiDayTest.php b/tests/Greece/OhiDayTest.php index 5bef29717..e23289303 100644 --- a/tests/Greece/OhiDayTest.php +++ b/tests/Greece/OhiDayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Επέτειος του Όχι'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Greece/PentecostMondayTest.php b/tests/Greece/PentecostMondayTest.php index 92cf30868..b75a1010f 100644 --- a/tests/Greece/PentecostMondayTest.php +++ b/tests/Greece/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Αγίου Πνεύματος'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Greece/PentecostTest.php b/tests/Greece/PentecostTest.php index 9e90aed4d..cd4bee069 100644 --- a/tests/Greece/PentecostTest.php +++ b/tests/Greece/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Πεντηκοστή'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Greece/PolytechnioTest.php b/tests/Greece/PolytechnioTest.php index 42be1901f..01d738f3a 100644 --- a/tests/Greece/PolytechnioTest.php +++ b/tests/Greece/PolytechnioTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Πολυτεχνείο'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OTHER ); } diff --git a/tests/Greece/ThreeHolyHierarchsTest.php b/tests/Greece/ThreeHolyHierarchsTest.php index 4975cbaa8..dcff8ab94 100644 --- a/tests/Greece/ThreeHolyHierarchsTest.php +++ b/tests/Greece/ThreeHolyHierarchsTest.php @@ -33,11 +33,10 @@ class ThreeHolyHierarchsTest extends GreeceBaseTestCase implements HolidayTestCa /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 30, self::TIMEZONE); + return static::generateRandomDates(1, 30, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Τριών Ιεραρχών'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Greece/goodFridayTest.php b/tests/Greece/goodFridayTest.php index 92fef334d..6b022496a 100644 --- a/tests/Greece/goodFridayTest.php +++ b/tests/Greece/goodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Μεγάλη Παρασκευή'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Hungary/AllSaintsDayTest.php b/tests/Hungary/AllSaintsDayTest.php index 02a9446f3..e83e71743 100644 --- a/tests/Hungary/AllSaintsDayTest.php +++ b/tests/Hungary/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends HungaryBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mindenszentek'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Hungary/ChristmasTest.php b/tests/Hungary/ChristmasTest.php index 27f675437..4b01eb70c 100644 --- a/tests/Hungary/ChristmasTest.php +++ b/tests/Hungary/ChristmasTest.php @@ -33,11 +33,10 @@ class ChristmasTest extends HungaryBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karácsony'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Hungary/EasterMondayTest.php b/tests/Hungary/EasterMondayTest.php index ef3b05b9c..7866fe7ab 100644 --- a/tests/Hungary/EasterMondayTest.php +++ b/tests/Hungary/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Húsvéthétfő'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Hungary/EasterTest.php b/tests/Hungary/EasterTest.php index 069626fac..e2b43a88a 100644 --- a/tests/Hungary/EasterTest.php +++ b/tests/Hungary/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Húsvét'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Hungary/HungaryTest.php b/tests/Hungary/HungaryTest.php index 126087c6c..6fcf2dfed 100644 --- a/tests/Hungary/HungaryTest.php +++ b/tests/Hungary/HungaryTest.php @@ -37,7 +37,7 @@ class HungaryTest extends HungaryBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1955); + $this->year = static::generateRandomYear(1955); } /** diff --git a/tests/Hungary/InternationalWorkersDayTest.php b/tests/Hungary/InternationalWorkersDayTest.php index eeb060741..aaafd9c43 100644 --- a/tests/Hungary/InternationalWorkersDayTest.php +++ b/tests/Hungary/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends HungaryBaseTestCase implements Holiday /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'A munka ünnepe'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Hungary/MemorialDay1848Test.php b/tests/Hungary/MemorialDay1848Test.php index 8a4709f35..d515dad83 100644 --- a/tests/Hungary/MemorialDay1848Test.php +++ b/tests/Hungary/MemorialDay1848Test.php @@ -42,7 +42,7 @@ class MemorialDay1848Test extends HungaryBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Az 1848-as forradalom ünnepe'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Hungary/MemorialDay1956Test.php b/tests/Hungary/MemorialDay1956Test.php index b5df349f8..9b1002147 100644 --- a/tests/Hungary/MemorialDay1956Test.php +++ b/tests/Hungary/MemorialDay1956Test.php @@ -42,7 +42,7 @@ class MemorialDay1956Test extends HungaryBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Az 1956-os forradalom ünnepe'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Hungary/NewYearsDayTest.php b/tests/Hungary/NewYearsDayTest.php index 3aa2cbdca..c4ec87626 100644 --- a/tests/Hungary/NewYearsDayTest.php +++ b/tests/Hungary/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends HungaryBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Újév'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Hungary/PentecostMondayTest.php b/tests/Hungary/PentecostMondayTest.php index ee517fe1b..3c2b6d81c 100644 --- a/tests/Hungary/PentecostMondayTest.php +++ b/tests/Hungary/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pünkösdhétfő'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Hungary/PentecostTest.php b/tests/Hungary/PentecostTest.php index 0d0b54f01..e0020a560 100644 --- a/tests/Hungary/PentecostTest.php +++ b/tests/Hungary/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pünkösd'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Hungary/SecondChristmasDayTest.php b/tests/Hungary/SecondChristmasDayTest.php index d192440cb..287fdb79a 100644 --- a/tests/Hungary/SecondChristmasDayTest.php +++ b/tests/Hungary/SecondChristmasDayTest.php @@ -33,11 +33,10 @@ class SecondChristmasDayTest extends HungaryBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karácsony másnapja'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Hungary/StateFoundationDayTest.php b/tests/Hungary/StateFoundationDayTest.php index bcb4fa77f..dbe1a336d 100644 --- a/tests/Hungary/StateFoundationDayTest.php +++ b/tests/Hungary/StateFoundationDayTest.php @@ -42,7 +42,7 @@ class StateFoundationDayTest extends HungaryBaseTestCase implements HolidayTestC */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Az államalapítás ünnepe'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Iran/AnniversaryOfIslamicRevolutionTest.php b/tests/Iran/AnniversaryOfIslamicRevolutionTest.php index 5bb08bd43..eb216b55e 100644 --- a/tests/Iran/AnniversaryOfIslamicRevolutionTest.php +++ b/tests/Iran/AnniversaryOfIslamicRevolutionTest.php @@ -32,7 +32,7 @@ public function testAnniversaryOfIslamicRevolutionBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) ); } @@ -41,7 +41,7 @@ public function testAnniversaryOfIslamicRevolutionBeforeEstablishment(): void */ public function testAnniversaryOfIslamicRevolutionAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [ self::LOCALE => 'انقلاب اسلامی پنجاه و هفت', 'en' => 'Enqelab e Eslami', @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Iran/DeathOfKhomeiniTest.php b/tests/Iran/DeathOfKhomeiniTest.php index d39132bbc..5db1b22ee 100644 --- a/tests/Iran/DeathOfKhomeiniTest.php +++ b/tests/Iran/DeathOfKhomeiniTest.php @@ -32,7 +32,7 @@ public function testDeathOfKhomeiniBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) ); } @@ -41,7 +41,7 @@ public function testDeathOfKhomeiniBeforeEstablishment(): void */ public function testDeathOfKhomeiniAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [ self::LOCALE => 'مرگ خمینی', 'en' => 'Marg e Khomeini', @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Iran/IranTest.php b/tests/Iran/IranTest.php index d24e1490c..33e695c16 100644 --- a/tests/Iran/IranTest.php +++ b/tests/Iran/IranTest.php @@ -32,7 +32,7 @@ class IranTest extends IranBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(); + $this->year = static::generateRandomYear(); } public function testOfficialHolidays(): void diff --git a/tests/Iran/IslamicRepublicDayTest.php b/tests/Iran/IslamicRepublicDayTest.php index 54bbed06e..d77d353a2 100644 --- a/tests/Iran/IslamicRepublicDayTest.php +++ b/tests/Iran/IslamicRepublicDayTest.php @@ -37,7 +37,7 @@ public function testIslamicRepublicDayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) ); } @@ -46,7 +46,7 @@ public function testIslamicRepublicDayBeforeEstablishment(): void */ public function testIslamicRepublicDayBeforeEquinoxYear(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::EQUINOX_YEAR - 1); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::EQUINOX_YEAR - 1); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -60,7 +60,7 @@ public function testIslamicRepublicDayBeforeEquinoxYear(): void */ public function testIslamicRepublicDayOnEquinoxYear(): void { - $year = $this->generateRandomYear(self::EQUINOX_YEAR, self::EQUINOX_YEAR); + $year = static::generateRandomYear(self::EQUINOX_YEAR, self::EQUINOX_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -74,7 +74,7 @@ public function testIslamicRepublicDayOnEquinoxYear(): void */ public function testIslamicRepublicDayAfterEquinoxYear(): void { - $year = $this->generateRandomYear(self::EQUINOX_YEAR + 1); + $year = static::generateRandomYear(self::EQUINOX_YEAR + 1); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -91,7 +91,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::EQUINOX_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::EQUINOX_YEAR), [ self::LOCALE => 'روز جمهوری اسلامی', 'en' => 'Ruz e Jomhuri ye Eslami', @@ -104,6 +104,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::EQUINOX_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::EQUINOX_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Iran/NationalizationOfTheIranianOilIndustryTest.php b/tests/Iran/NationalizationOfTheIranianOilIndustryTest.php index a0cf534aa..a343eb32b 100644 --- a/tests/Iran/NationalizationOfTheIranianOilIndustryTest.php +++ b/tests/Iran/NationalizationOfTheIranianOilIndustryTest.php @@ -32,7 +32,7 @@ public function testNationalizationOfTheIranianOilIndustryBeforeEstablishment(): $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) ); } @@ -41,7 +41,7 @@ public function testNationalizationOfTheIranianOilIndustryBeforeEstablishment(): */ public function testNationalizationOfTheIranianOilIndustryAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [ self::LOCALE => 'ملی شدن صنعت نفت', 'en' => 'Melli Shodan e Saneat e Naft', @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Iran/Nowruz1Test.php b/tests/Iran/Nowruz1Test.php index 887d1c3c3..fcb6d50b2 100644 --- a/tests/Iran/Nowruz1Test.php +++ b/tests/Iran/Nowruz1Test.php @@ -29,7 +29,7 @@ class Nowruz1Test extends IranBaseTestCase implements HolidayTestCase */ public function testNowruz1(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -46,7 +46,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [ self::LOCALE => 'نوروز', 'en' => 'Nowruz', @@ -59,6 +59,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Iran/Nowruz2Test.php b/tests/Iran/Nowruz2Test.php index 28207a2f6..f3528b55f 100644 --- a/tests/Iran/Nowruz2Test.php +++ b/tests/Iran/Nowruz2Test.php @@ -29,7 +29,7 @@ class Nowruz2Test extends IranBaseTestCase implements HolidayTestCase */ public function testNowruz2(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -46,7 +46,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [ self::LOCALE => 'نوروز', 'en' => 'Nowruz', @@ -59,6 +59,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Iran/Nowruz3Test.php b/tests/Iran/Nowruz3Test.php index 3efb4fca6..ef323da62 100644 --- a/tests/Iran/Nowruz3Test.php +++ b/tests/Iran/Nowruz3Test.php @@ -29,7 +29,7 @@ class Nowruz3Test extends IranBaseTestCase implements HolidayTestCase */ public function testNowruz3(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -46,7 +46,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [ self::LOCALE => 'نوروز', 'en' => 'Nowruz', @@ -59,6 +59,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Iran/Nowruz4Test.php b/tests/Iran/Nowruz4Test.php index 9fc6f9fe7..2b04571b1 100644 --- a/tests/Iran/Nowruz4Test.php +++ b/tests/Iran/Nowruz4Test.php @@ -29,7 +29,7 @@ class Nowruz4Test extends IranBaseTestCase implements HolidayTestCase */ public function testNowruz4(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -46,7 +46,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [ self::LOCALE => 'نوروز', 'en' => 'Nowruz', @@ -59,6 +59,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Iran/RevoltOfKhordad15Test.php b/tests/Iran/RevoltOfKhordad15Test.php index 94219b7ad..eaa43589d 100644 --- a/tests/Iran/RevoltOfKhordad15Test.php +++ b/tests/Iran/RevoltOfKhordad15Test.php @@ -32,7 +32,7 @@ public function testRevoltOfKhordad15BeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) ); } @@ -41,7 +41,7 @@ public function testRevoltOfKhordad15BeforeEstablishment(): void */ public function testRevoltOfKhordad15AfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [ self::LOCALE => 'قیام ۱۵ خرداد', 'en' => 'Qiam e Panzdah e Khordad', @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Iran/SizdahBedarTest.php b/tests/Iran/SizdahBedarTest.php index 2f09002c7..12e94757f 100644 --- a/tests/Iran/SizdahBedarTest.php +++ b/tests/Iran/SizdahBedarTest.php @@ -29,7 +29,7 @@ class SizdahBedarTest extends IranBaseTestCase implements HolidayTestCase */ public function testSizdahBedar(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -46,7 +46,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [ self::LOCALE => 'سیزده بدر', 'en' => 'Sizdah be dar', @@ -59,6 +59,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Ireland/AugustHolidayTest.php b/tests/Ireland/AugustHolidayTest.php index 2acfdfda5..12e2a8eeb 100644 --- a/tests/Ireland/AugustHolidayTest.php +++ b/tests/Ireland/AugustHolidayTest.php @@ -33,13 +33,12 @@ class AugustHolidayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -58,12 +57,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("next monday {$year}-7-31", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,13 +81,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'August Holiday'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), ['ga_IE' => 'Lá Saoire i mí Lúnasa'] ); } @@ -100,6 +99,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Ireland/ChristmasDayTest.php b/tests/Ireland/ChristmasDayTest.php index b95fe1e8c..2e89e91dd 100644 --- a/tests/Ireland/ChristmasDayTest.php +++ b/tests/Ireland/ChristmasDayTest.php @@ -33,13 +33,12 @@ class ChristmasDayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -58,12 +57,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-25", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -81,13 +80,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), ['ga_IE' => 'Lá Nollag'] ); } @@ -99,6 +98,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Ireland/EasterMondayTest.php b/tests/Ireland/EasterMondayTest.php index d51029d07..49bd6a513 100644 --- a/tests/Ireland/EasterMondayTest.php +++ b/tests/Ireland/EasterMondayTest.php @@ -33,13 +33,12 @@ class EasterMondayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->add(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,13 +81,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Monday'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), ['ga_IE' => 'Luan Cásca'] ); } @@ -100,6 +99,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Ireland/EasterTest.php b/tests/Ireland/EasterTest.php index e1c77e2fd..c91fa0564 100644 --- a/tests/Ireland/EasterTest.php +++ b/tests/Ireland/EasterTest.php @@ -33,13 +33,12 @@ class EasterTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $data[] = [$year, $date->format('Y-m-d')]; } @@ -81,13 +80,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Sunday'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), ['ga_IE' => 'Domhnach Cásca'] ); } @@ -99,6 +98,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Ireland/GoodFridayTest.php b/tests/Ireland/GoodFridayTest.php index 6114353a0..3f76f2967 100644 --- a/tests/Ireland/GoodFridayTest.php +++ b/tests/Ireland/GoodFridayTest.php @@ -33,13 +33,12 @@ class GoodFridayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->sub(new \DateInterval('P2D')); $data[] = [$year, $date->format('Y-m-d')]; } @@ -81,13 +80,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Good Friday'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), ['ga_IE' => 'Aoine an Chéasta'] ); } @@ -99,6 +98,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Ireland/IrelandTest.php b/tests/Ireland/IrelandTest.php index 15f3ffc54..ad8c239c1 100644 --- a/tests/Ireland/IrelandTest.php +++ b/tests/Ireland/IrelandTest.php @@ -37,7 +37,7 @@ class IrelandTest extends IrelandBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1974); + $this->year = static::generateRandomYear(1974); } /** diff --git a/tests/Ireland/JuneHolidayTest.php b/tests/Ireland/JuneHolidayTest.php index 64d1f8354..27e4d8c89 100644 --- a/tests/Ireland/JuneHolidayTest.php +++ b/tests/Ireland/JuneHolidayTest.php @@ -38,13 +38,12 @@ class JuneHolidayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -63,12 +62,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("next monday {$year}-5-31", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -87,7 +86,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -101,13 +100,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'June Holiday'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), ['ga_IE' => 'Lá Saoire i mí an Mheithimh'] ); } @@ -122,7 +121,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Ireland/MayDayTest.php b/tests/Ireland/MayDayTest.php index 430498d01..5de06305d 100644 --- a/tests/Ireland/MayDayTest.php +++ b/tests/Ireland/MayDayTest.php @@ -38,13 +38,12 @@ class MayDayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -63,12 +62,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("next monday {$year}-4-30", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -87,7 +86,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -101,13 +100,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'May Day'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), ['ga_IE' => 'Lá Bealtaine'] ); } @@ -122,7 +121,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Ireland/NewYearsDayTest.php b/tests/Ireland/NewYearsDayTest.php index 36d1e3224..f3ad12501 100644 --- a/tests/Ireland/NewYearsDayTest.php +++ b/tests/Ireland/NewYearsDayTest.php @@ -38,13 +38,12 @@ class NewYearsDayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -63,12 +62,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-1-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -86,7 +85,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -100,13 +99,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'New Year’s Day'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), ['ga_IE' => 'Lá Caille'] ); } @@ -121,7 +120,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Ireland/OctoberHolidayTest.php b/tests/Ireland/OctoberHolidayTest.php index 4ec8b737d..dd038f684 100644 --- a/tests/Ireland/OctoberHolidayTest.php +++ b/tests/Ireland/OctoberHolidayTest.php @@ -38,13 +38,12 @@ class OctoberHolidayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -63,12 +62,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("previous monday {$year}-11-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -87,7 +86,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -101,13 +100,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'October Holiday'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), ['ga_IE' => 'Lá Saoire i mí Dheireadh Fómhair'] ); } @@ -122,7 +121,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Ireland/PentecostTest.php b/tests/Ireland/PentecostTest.php index 710ca8db2..76900bc82 100644 --- a/tests/Ireland/PentecostTest.php +++ b/tests/Ireland/PentecostTest.php @@ -33,13 +33,12 @@ class PentecostTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,14 +56,14 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; // for ($y = 0; $y < self::TEST_ITERATIONS; $y++) { for ($y = 0; $y < 2; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->add(new \DateInterval('P49D')); $data[] = [$year, $date->format('Y-m-d')]; } @@ -82,13 +81,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Whitsunday'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), ['ga_IE' => 'Domhnach Cincíse'] ); } @@ -100,6 +99,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Ireland/StBrigidsDayTest.php b/tests/Ireland/StBrigidsDayTest.php index 2d66f393b..a8c6218f8 100644 --- a/tests/Ireland/StBrigidsDayTest.php +++ b/tests/Ireland/StBrigidsDayTest.php @@ -38,13 +38,12 @@ class StBrigidsDayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $dateTime = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -63,12 +62,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-02-01", new \DateTimeZone(self::TIMEZONE)); if ('Friday' !== $date->format('l')) { $date = new \DateTime("{$year}-02-01 first monday", new \DateTimeZone(self::TIMEZONE)); @@ -90,7 +89,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -104,13 +103,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Saint Brigid’s Day'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), ['ga' => 'Lá Fhéile Bríde'] ); } @@ -125,7 +124,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Ireland/StPatricksDayTest.php b/tests/Ireland/StPatricksDayTest.php index 03a2aa216..0d2034c01 100644 --- a/tests/Ireland/StPatricksDayTest.php +++ b/tests/Ireland/StPatricksDayTest.php @@ -38,13 +38,12 @@ class StPatricksDayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -63,12 +62,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-3-17", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -86,7 +85,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -100,13 +99,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'St. Patrick’s Day'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), ['ga_IE' => 'Lá Fhéile Pádraig'] ); } @@ -121,7 +120,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Ireland/StStephensDayTest.php b/tests/Ireland/StStephensDayTest.php index c55ffb064..d233ecd6b 100644 --- a/tests/Ireland/StStephensDayTest.php +++ b/tests/Ireland/StStephensDayTest.php @@ -33,13 +33,12 @@ class StStephensDayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -58,12 +57,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-26", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -81,13 +80,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'St. Stephen’s Day'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), ['ga_IE' => 'Lá Fhéile Stiofáin'] ); } @@ -99,6 +98,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Ireland/pentecostMondayTest.php b/tests/Ireland/pentecostMondayTest.php index 132f38996..8ce15cdf9 100644 --- a/tests/Ireland/pentecostMondayTest.php +++ b/tests/Ireland/pentecostMondayTest.php @@ -38,13 +38,12 @@ class pentecostMondayTest extends IrelandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -62,13 +61,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(1000, self::ABOLISHMENT_YEAR); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(1000, self::ABOLISHMENT_YEAR); + $date = static::computeEaster($year, self::TIMEZONE); $date->add(new \DateInterval('P50D')); $data[] = [$year, $date->format('Y-m-d')]; } @@ -83,7 +82,7 @@ public function HolidayDataProvider(): array */ public function testHolidayDayAfterAbolishment(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ABOLISHMENT_YEAR + 1)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ABOLISHMENT_YEAR + 1)); } /** @@ -96,13 +95,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ABOLISHMENT_YEAR), + static::generateRandomYear(1000, self::ABOLISHMENT_YEAR), [self::LOCALE => 'Whitmonday'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ABOLISHMENT_YEAR), + static::generateRandomYear(1000, self::ABOLISHMENT_YEAR), ['ga_IE' => 'Luan Cincíse'] ); } @@ -117,7 +116,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ABOLISHMENT_YEAR), + static::generateRandomYear(1000, self::ABOLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Italy/AllSaintsDayTest.php b/tests/Italy/AllSaintsDayTest.php index c3b995f92..1ca2be2c8 100644 --- a/tests/Italy/AllSaintsDayTest.php +++ b/tests/Italy/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends ItalyBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): v * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Festa di Tutti i Santi'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Italy/AssumptionOfMaryTest.php b/tests/Italy/AssumptionOfMaryTest.php index 1b7e17f5c..cab6ca8a6 100644 --- a/tests/Italy/AssumptionOfMaryTest.php +++ b/tests/Italy/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends ItalyBaseTestCase implements HolidayTestCase /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): v * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Assunzione di Maria Vergine'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Italy/ChristmasTest.php b/tests/Italy/ChristmasTest.php index 855b30774..e656612e7 100644 --- a/tests/Italy/ChristmasTest.php +++ b/tests/Italy/ChristmasTest.php @@ -33,11 +33,10 @@ class ChristmasTest extends ItalyBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Natale'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Italy/EasterMondayTest.php b/tests/Italy/EasterMondayTest.php index 5bad36951..36598c0ec 100644 --- a/tests/Italy/EasterMondayTest.php +++ b/tests/Italy/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lunedì dell’Angelo'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Italy/EasterTest.php b/tests/Italy/EasterTest.php index 60f4e0749..a4329d156 100644 --- a/tests/Italy/EasterTest.php +++ b/tests/Italy/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pasqua'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Italy/EpiphanyTest.php b/tests/Italy/EpiphanyTest.php index e1be28fd5..9148a2280 100644 --- a/tests/Italy/EpiphanyTest.php +++ b/tests/Italy/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends ItalyBaseTestCase implements HolidayTestCase /** * Tests Epiphany. * - * @dataProvider EpiphanyDataProvider - * * @param int $year the year for which Epiphany needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('EpiphanyDataProvider')] public function testEpiphany(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testEpiphany(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function EpiphanyDataProvider(): array + public static function EpiphanyDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Epifania'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Italy/ImmaculateConceptionTest.php b/tests/Italy/ImmaculateConceptionTest.php index ed4e61551..f69e351d2 100644 --- a/tests/Italy/ImmaculateConceptionTest.php +++ b/tests/Italy/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends ItalyBaseTestCase implements HolidayTestC /** * Tests the day of Immaculate Conception. * - * @dataProvider ImmaculateConceptionDataProvider - * * @param int $year the year for which the day of Immaculate Conception needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ImmaculateConceptionDataProvider')] public function testImmaculateConception(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testImmaculateConception(int $year, \DateTimeInterface $expected * * @throws \Exception */ - public function ImmaculateConceptionDataProvider(): array + public static function ImmaculateConceptionDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Immacolata Concezione'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Italy/InternationalWorkersDayTest.php b/tests/Italy/InternationalWorkersDayTest.php index c3a1cdae7..3390673d6 100644 --- a/tests/Italy/InternationalWorkersDayTest.php +++ b/tests/Italy/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends ItalyBaseTestCase implements HolidayTe /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testInternationalWorkersDay(int $year, \DateTimeInterface $expec * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Festa del Lavoro'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Italy/ItalyTest.php b/tests/Italy/ItalyTest.php index b6098272b..a5c1a9356 100644 --- a/tests/Italy/ItalyTest.php +++ b/tests/Italy/ItalyTest.php @@ -37,7 +37,7 @@ class ItalyTest extends ItalyBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1949); + $this->year = static::generateRandomYear(1949); } /** diff --git a/tests/Italy/LiberationDayTest.php b/tests/Italy/LiberationDayTest.php index 2b3dbad0d..566544b60 100644 --- a/tests/Italy/LiberationDayTest.php +++ b/tests/Italy/LiberationDayTest.php @@ -49,7 +49,7 @@ class LiberationDayTest extends ItalyBaseTestCase implements HolidayTestCase */ public function testLiberationDayOnAfter1949(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -68,7 +68,7 @@ public function testLiberationDayBefore1949(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -82,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Festa della Liberazione'] ); } @@ -97,7 +97,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Italy/NewYearsDayTest.php b/tests/Italy/NewYearsDayTest.php index 91d83dd8c..1d89ae280 100644 --- a/tests/Italy/NewYearsDayTest.php +++ b/tests/Italy/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends ItalyBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testNewYearsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Capodanno'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Italy/RepublicDayTest.php b/tests/Italy/RepublicDayTest.php index 8a3828053..7eb1cb8a5 100644 --- a/tests/Italy/RepublicDayTest.php +++ b/tests/Italy/RepublicDayTest.php @@ -49,7 +49,7 @@ class RepublicDayTest extends ItalyBaseTestCase implements HolidayTestCase */ public function testRepublicDayOnAfter1946(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -68,7 +68,7 @@ public function testRepublicDayBefore1946(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -82,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Festa della Repubblica'] ); } @@ -97,7 +97,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Italy/stStephensDayTest.php b/tests/Italy/stStephensDayTest.php index f58b1107f..3b78f1bf8 100644 --- a/tests/Italy/stStephensDayTest.php +++ b/tests/Italy/stStephensDayTest.php @@ -33,11 +33,10 @@ class stStephensDayTest extends ItalyBaseTestCase implements HolidayTestCase /** * Tests the day of St. Stephen's Day. * - * @dataProvider stStephensDayDataProvider - * * @param int $year the year for which St. Stephen's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('stStephensDayDataProvider')] public function teststStephensDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function teststStephensDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function stStephensDayDataProvider(): array + public static function stStephensDayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Santo Stefano'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Japan/AutumnalEquinoxDayTest.php b/tests/Japan/AutumnalEquinoxDayTest.php index 18f759634..e9d8d857b 100644 --- a/tests/Japan/AutumnalEquinoxDayTest.php +++ b/tests/Japan/AutumnalEquinoxDayTest.php @@ -46,7 +46,7 @@ class AutumnalEquinoxDayTest extends JapanBaseTestCase implements HolidayTestCas */ public function testAutumnalEquinoxDayOnAfter2150(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(2151)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(2151)); } /** @@ -56,14 +56,13 @@ public function testAutumnalEquinoxDayOnAfter2150(): void * * After 2150 no calculations are available yet. * - * @dataProvider autumnalEquinoxHolidaysProvider - * * @param int $year year of example data to be tested * @param int $month month (number) of example data to be tested * @param int $day day of the month (number) of example data to be tested * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('autumnalEquinoxHolidaysProvider')] public function testAutumnalEquinoxDayBetween1948And2150(int $year, int $month, int $day): void { $this->assertHoliday( @@ -79,7 +78,7 @@ public function testAutumnalEquinoxDayBetween1948And2150(int $year, int $month, * * @return array list of test dates for the holiday defined in this test */ - public function autumnalEquinoxHolidaysProvider(): array + public static function autumnalEquinoxHolidaysProvider(): array { return [ [1951, 9, 24], @@ -102,7 +101,7 @@ public function testAutumnalEquinoxDayBefore1948(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -116,7 +115,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2150), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2150), [self::LOCALE => '秋分の日'] ); } @@ -131,7 +130,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2150), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2150), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/ChildrensDayTest.php b/tests/Japan/ChildrensDayTest.php index 724a91338..f456f3400 100644 --- a/tests/Japan/ChildrensDayTest.php +++ b/tests/Japan/ChildrensDayTest.php @@ -77,7 +77,7 @@ public function testChildrensDayBefore1948(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +91,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'こどもの日'] ); } @@ -106,7 +106,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/ComingOfAgeDayTest.php b/tests/Japan/ComingOfAgeDayTest.php index b0fd62dcf..14529ce15 100644 --- a/tests/Japan/ComingOfAgeDayTest.php +++ b/tests/Japan/ComingOfAgeDayTest.php @@ -43,7 +43,7 @@ class ComingOfAgeDayTest extends JapanBaseTestCase implements HolidayTestCase */ public function testComingOfAgeDayOnAfter2000(): void { - $year = $this->generateRandomYear(2001); + $year = static::generateRandomYear(2001); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -80,7 +80,7 @@ public function testConstitutionMemorialDayBefore1948(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -94,7 +94,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '成人の日'] ); } @@ -109,7 +109,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/ConstitutionMemorialDayTest.php b/tests/Japan/ConstitutionMemorialDayTest.php index 18c727048..0e6e36835 100644 --- a/tests/Japan/ConstitutionMemorialDayTest.php +++ b/tests/Japan/ConstitutionMemorialDayTest.php @@ -78,7 +78,7 @@ public function testConstitutionMemorialDayBefore1948(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -92,7 +92,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '憲法記念日'] ); } @@ -107,7 +107,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/CoronationDayTest.php b/tests/Japan/CoronationDayTest.php index 13dc1a3e4..327ab282e 100644 --- a/tests/Japan/CoronationDayTest.php +++ b/tests/Japan/CoronationDayTest.php @@ -56,7 +56,7 @@ public function testEmperorsBirthdayBefore2019(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -68,7 +68,7 @@ public function testEmperorsBirthdayAfter2020(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR + 1) + static::generateRandomYear(self::ESTABLISHMENT_YEAR + 1) ); } diff --git a/tests/Japan/CultureDayTest.php b/tests/Japan/CultureDayTest.php index ebd202a0e..641e37f4e 100644 --- a/tests/Japan/CultureDayTest.php +++ b/tests/Japan/CultureDayTest.php @@ -77,7 +77,7 @@ public function testCultureDayBefore1948(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +91,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '文化の日'] ); } @@ -106,7 +106,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/EmperorsBirthdayTest.php b/tests/Japan/EmperorsBirthdayTest.php index 5321931ce..241fa557b 100644 --- a/tests/Japan/EmperorsBirthdayTest.php +++ b/tests/Japan/EmperorsBirthdayTest.php @@ -45,7 +45,7 @@ class EmperorsBirthdayTest extends JapanBaseTestCase implements HolidayTestCase */ public function testEmperorsBirthdayOnAfter1949(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1988); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1988); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testEmperorsBirthdayOnAfter1949(): void */ public function testEmperorsBirthdayOnAfter1989(): void { - $year = $this->generateRandomYear(1989, 2018); + $year = static::generateRandomYear(1989, 2018); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -80,7 +80,7 @@ public function testEmperorsBirthdayOnAfter1989(): void */ public function testEmperorsBirthdayOnAfter2020(): void { - $year = $this->generateRandomYear(2020); + $year = static::generateRandomYear(2020); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -116,7 +116,7 @@ public function testEmperorsBirthdayBefore1949(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -142,7 +142,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '天皇誕生日'] ); } @@ -157,7 +157,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/EnthronementProclamationCeremonyTest.php b/tests/Japan/EnthronementProclamationCeremonyTest.php index e2cd4c750..9effce40d 100644 --- a/tests/Japan/EnthronementProclamationCeremonyTest.php +++ b/tests/Japan/EnthronementProclamationCeremonyTest.php @@ -56,7 +56,7 @@ public function testEmperorsBirthdayBefore2019(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::IMPLEMENT_YEAR - 1) + static::generateRandomYear(1000, self::IMPLEMENT_YEAR - 1) ); } @@ -68,7 +68,7 @@ public function testEmperorsBirthdayAfter2020(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::IMPLEMENT_YEAR + 1) + static::generateRandomYear(self::IMPLEMENT_YEAR + 1) ); } diff --git a/tests/Japan/GreeneryDayTest.php b/tests/Japan/GreeneryDayTest.php index faf90cee3..4b969cbcf 100644 --- a/tests/Japan/GreeneryDayTest.php +++ b/tests/Japan/GreeneryDayTest.php @@ -112,7 +112,7 @@ public function testHolidayBefore1989(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -126,7 +126,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'みどりの日'] ); } @@ -141,7 +141,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/JapanTest.php b/tests/Japan/JapanTest.php index 07398bf79..412ab9905 100644 --- a/tests/Japan/JapanTest.php +++ b/tests/Japan/JapanTest.php @@ -37,7 +37,7 @@ class JapanTest extends JapanBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(2020, 2150); + $this->year = static::generateRandomYear(2020, 2150); } /** diff --git a/tests/Japan/LabourThanksgivingDayTest.php b/tests/Japan/LabourThanksgivingDayTest.php index 9768e3378..78f1c65e3 100644 --- a/tests/Japan/LabourThanksgivingDayTest.php +++ b/tests/Japan/LabourThanksgivingDayTest.php @@ -80,7 +80,7 @@ public function testLabourThanksgivingDayBefore1948(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -94,7 +94,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '勤労感謝の日'] ); } @@ -109,7 +109,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/MarineDayTest.php b/tests/Japan/MarineDayTest.php index 0f9284703..47e6abb61 100644 --- a/tests/Japan/MarineDayTest.php +++ b/tests/Japan/MarineDayTest.php @@ -71,7 +71,7 @@ public function testMarineDayIn2021(): void */ public function testMarineDayOnAfter2003(): void { - $year = $this->generateRandomYear(2004); + $year = self::generateRandomYear(2004); if (in_array($year, [2020, 2021])) { return; @@ -129,7 +129,7 @@ public function testMarineDayBefore1996(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + self::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -143,7 +143,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + self::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '海の日'] ); } @@ -158,7 +158,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + self::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/MountainDayTest.php b/tests/Japan/MountainDayTest.php index cc4f24596..496a166f7 100644 --- a/tests/Japan/MountainDayTest.php +++ b/tests/Japan/MountainDayTest.php @@ -109,7 +109,7 @@ public function testMountainDayBefore2016(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -123,7 +123,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '山の日'] ); } @@ -138,7 +138,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/NationalFoundationDayTest.php b/tests/Japan/NationalFoundationDayTest.php index 6962ff957..45a84d30b 100644 --- a/tests/Japan/NationalFoundationDayTest.php +++ b/tests/Japan/NationalFoundationDayTest.php @@ -78,7 +78,7 @@ public function testNationalFoundationDayBefore1966(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -92,7 +92,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '建国記念の日'] ); } @@ -107,7 +107,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/NewYearsDayTest.php b/tests/Japan/NewYearsDayTest.php index 193b70bc8..aa11b4a5f 100644 --- a/tests/Japan/NewYearsDayTest.php +++ b/tests/Japan/NewYearsDayTest.php @@ -77,7 +77,7 @@ public function testNewYearsDayBefore1948(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +91,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '元日'] ); } @@ -106,7 +106,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/RespectForTheAgedDayTest.php b/tests/Japan/RespectForTheAgedDayTest.php index 53e00b98c..81f35fe27 100644 --- a/tests/Japan/RespectForTheAgedDayTest.php +++ b/tests/Japan/RespectForTheAgedDayTest.php @@ -43,7 +43,7 @@ class RespectForTheAgedDayTest extends JapanBaseTestCase implements HolidayTestC */ public function testRespectForTheAgedDayOnAfter2003(): void { - $year = $this->generateRandomYear(2004); + $year = static::generateRandomYear(2004); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -97,7 +97,7 @@ public function testRespectForTheAgedDayBefore1996(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -111,7 +111,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '敬老の日'] ); } @@ -126,7 +126,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/ShowaDayTest.php b/tests/Japan/ShowaDayTest.php index c478996df..8d1d906cb 100644 --- a/tests/Japan/ShowaDayTest.php +++ b/tests/Japan/ShowaDayTest.php @@ -77,7 +77,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +91,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '昭和の日'] ); } @@ -106,7 +106,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/SportsDayTest.php b/tests/Japan/SportsDayTest.php index b4e116bd8..6ad586245 100644 --- a/tests/Japan/SportsDayTest.php +++ b/tests/Japan/SportsDayTest.php @@ -76,7 +76,7 @@ public function testSportsDayIn2020(): void */ public function testSportsDayAfter2000(): void { - $year = $this->generateRandomYear(2001); + $year = static::generateRandomYear(2001); // Some years the date has changed, so in this test we need to skip them. if (! in_array($year, [2020, 2021])) { @@ -134,7 +134,7 @@ public function testSportsDayBefore1996(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -149,7 +149,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2019), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2019), [self::LOCALE => '体育の日'] ); } @@ -166,7 +166,7 @@ public function testTranslationFrom2020(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear($year), + static::generateRandomYear($year), [self::LOCALE => 'スポーツの日'] ); } @@ -181,7 +181,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Japan/VernalEquinoxDayTest.php b/tests/Japan/VernalEquinoxDayTest.php index ce20d8b6b..7af809e7a 100644 --- a/tests/Japan/VernalEquinoxDayTest.php +++ b/tests/Japan/VernalEquinoxDayTest.php @@ -46,7 +46,7 @@ class VernalEquinoxDayTest extends JapanBaseTestCase implements HolidayTestCase */ public function testVernalEquinoxDayOnAfter2150(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(2151)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(2151)); } /** @@ -56,14 +56,13 @@ public function testVernalEquinoxDayOnAfter2150(): void * * After 2150 no calculations are available yet. * - * @dataProvider vernalEquinoxHolidaysProvider - * * @param int $year year of example data to be tested * @param int $month month (number) of example data to be tested * @param int $day day of the month (number) of example data to be tested * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('vernalEquinoxHolidaysProvider')] public function testVernalEquinoxDayBetween1948And2150(int $year, int $month, int $day): void { $this->assertHoliday( @@ -79,7 +78,7 @@ public function testVernalEquinoxDayBetween1948And2150(int $year, int $month, in * * @return array list of test dates for the holiday defined in this test */ - public function vernalEquinoxHolidaysProvider(): array + public static function vernalEquinoxHolidaysProvider(): array { return [ [1948, 3, 22], @@ -102,7 +101,7 @@ public function testVernalEquinoxDayBefore1948(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -116,7 +115,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2150), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2150), [self::LOCALE => '春分の日'] ); } @@ -131,7 +130,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2150), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2150), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Latvia/ChristmasDayTest.php b/tests/Latvia/ChristmasDayTest.php index 6875a6cf1..5fd2651bd 100644 --- a/tests/Latvia/ChristmasDayTest.php +++ b/tests/Latvia/ChristmasDayTest.php @@ -37,14 +37,12 @@ class ChristmasDayTest extends LatviaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ziemassvētki'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/ChristmasEveDayTest.php b/tests/Latvia/ChristmasEveDayTest.php index 7171533de..6fb51af52 100644 --- a/tests/Latvia/ChristmasEveDayTest.php +++ b/tests/Latvia/ChristmasEveDayTest.php @@ -37,14 +37,12 @@ class ChristmasEveDayTest extends LatviaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(12, 24, self::TIMEZONE); + return static::generateRandomDates(12, 24, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ziemassvētku vakars'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/EasterDayTest.php b/tests/Latvia/EasterDayTest.php index 787cd31b5..84fc7bb2a 100644 --- a/tests/Latvia/EasterDayTest.php +++ b/tests/Latvia/EasterDayTest.php @@ -37,21 +37,20 @@ class EasterDayTest extends LatviaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomEasterDates(self::TIMEZONE); + return static::generateRandomEasterDates(self::TIMEZONE); } /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lieldienas'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/EasterMondayDayTest.php b/tests/Latvia/EasterMondayDayTest.php index 05a03df28..ba1f8935f 100644 --- a/tests/Latvia/EasterMondayDayTest.php +++ b/tests/Latvia/EasterMondayDayTest.php @@ -37,21 +37,20 @@ class EasterMondayDayTest extends LatviaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomEasterMondayDates(self::TIMEZONE); + return static::generateRandomEasterMondayDates(self::TIMEZONE); } /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Otrās Lieldienas'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/GoodFridayDayTest.php b/tests/Latvia/GoodFridayDayTest.php index d9beded1f..3150eead6 100644 --- a/tests/Latvia/GoodFridayDayTest.php +++ b/tests/Latvia/GoodFridayDayTest.php @@ -37,21 +37,20 @@ class GoodFridayDayTest extends LatviaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomGoodFridayDates(self::TIMEZONE); + return static::generateRandomGoodFridayDates(self::TIMEZONE); } /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lielā Piektdiena'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/InternationalWorkersDayTest.php b/tests/Latvia/InternationalWorkersDayTest.php index 1398f8cd0..9e375dfb0 100644 --- a/tests/Latvia/InternationalWorkersDayTest.php +++ b/tests/Latvia/InternationalWorkersDayTest.php @@ -37,14 +37,12 @@ class InternationalWorkersDayTest extends LatviaBaseTestCase implements HolidayT * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Darba svētki'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/LatviaTest.php b/tests/Latvia/LatviaTest.php index 5676cf4cb..aeb60437d 100644 --- a/tests/Latvia/LatviaTest.php +++ b/tests/Latvia/LatviaTest.php @@ -50,7 +50,7 @@ public function testOfficialHolidays(): void 'newYearsEve', ]; - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); if ($year >= Latvia::RESTORATION_OF_INDEPENDENCE_YEAR) { $holidays[] = 'restorationOfIndependenceOfLatviaDay'; @@ -74,7 +74,7 @@ public function testOfficialHolidays(): void */ public function testObservedHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** @@ -84,7 +84,7 @@ public function testObservedHolidays(): void */ public function testSeasonalHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_SEASON); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_SEASON); } /** @@ -94,7 +94,7 @@ public function testSeasonalHolidays(): void */ public function testBankHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_BANK); } /** @@ -104,7 +104,7 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** diff --git a/tests/Latvia/MidsummerEveDayTest.php b/tests/Latvia/MidsummerEveDayTest.php index c019650b5..b0ceea670 100644 --- a/tests/Latvia/MidsummerEveDayTest.php +++ b/tests/Latvia/MidsummerEveDayTest.php @@ -37,14 +37,12 @@ class MidsummerEveDayTest extends LatviaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(6, 23, self::TIMEZONE); + return static::generateRandomDates(6, 23, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Līgo Diena', 'en' => 'Midsummer Eve'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/MothersDayTest.php b/tests/Latvia/MothersDayTest.php index de24d3ded..c044099c5 100644 --- a/tests/Latvia/MothersDayTest.php +++ b/tests/Latvia/MothersDayTest.php @@ -37,7 +37,7 @@ class MothersDayTest extends LatviaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Mātes dienu'] ); } @@ -64,6 +64,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/NewYearsDayTest.php b/tests/Latvia/NewYearsDayTest.php index 004cbc4b3..c58b9732c 100644 --- a/tests/Latvia/NewYearsDayTest.php +++ b/tests/Latvia/NewYearsDayTest.php @@ -37,14 +37,12 @@ class NewYearsDayTest extends LatviaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Jaunais Gads'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/NewYearsEveDayTest.php b/tests/Latvia/NewYearsEveDayTest.php index f501eb928..759baf72d 100644 --- a/tests/Latvia/NewYearsEveDayTest.php +++ b/tests/Latvia/NewYearsEveDayTest.php @@ -37,14 +37,12 @@ class NewYearsEveDayTest extends LatviaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(12, 31, self::TIMEZONE); + return static::generateRandomDates(12, 31, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vecgada vakars', 'en' => 'New Year’s Eve'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/PentecostTest.php b/tests/Latvia/PentecostTest.php index ba0bf00bd..021f0671d 100644 --- a/tests/Latvia/PentecostTest.php +++ b/tests/Latvia/PentecostTest.php @@ -35,21 +35,20 @@ class PentecostTest extends LatviaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomPentecostDates(self::TIMEZONE); + return static::generateRandomPentecostDates(self::TIMEZONE); } /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -68,7 +67,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vasarsvētkus'] ); } @@ -78,6 +77,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/ProclamationOfTheRepublicOfLatviaDayTest.php b/tests/Latvia/ProclamationOfTheRepublicOfLatviaDayTest.php index 66b1bd07d..fbc59afc0 100644 --- a/tests/Latvia/ProclamationOfTheRepublicOfLatviaDayTest.php +++ b/tests/Latvia/ProclamationOfTheRepublicOfLatviaDayTest.php @@ -43,7 +43,7 @@ public function testNotHoliday(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Latvia::PROCLAMATION_OF_INDEPENDENCE_YEAR - 1) + static::generateRandomYear(1000, Latvia::PROCLAMATION_OF_INDEPENDENCE_YEAR - 1) ); } @@ -52,9 +52,9 @@ public function testNotHoliday(): void * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDatesWithHolidayMovedToMonday( + return static::generateRandomDatesWithHolidayMovedToMonday( 11, 18, self::TIMEZONE, @@ -66,13 +66,12 @@ public function holidayDataProvider(): array /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Latvia::PROCLAMATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Latvia::PROCLAMATION_OF_INDEPENDENCE_YEAR), [ self::LOCALE => 'Latvijas Republikas proklamēšanas diena', 'en' => 'Proclamation Day of the Republic of Latvia', @@ -107,7 +106,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Latvia::PROCLAMATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Latvia::PROCLAMATION_OF_INDEPENDENCE_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Latvia/RestorationOfIndependenceDayTest.php b/tests/Latvia/RestorationOfIndependenceDayTest.php index e4e212133..81f25e274 100644 --- a/tests/Latvia/RestorationOfIndependenceDayTest.php +++ b/tests/Latvia/RestorationOfIndependenceDayTest.php @@ -43,7 +43,7 @@ public function testNotHoliday(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Latvia::RESTORATION_OF_INDEPENDENCE_YEAR - 1) + static::generateRandomYear(1000, Latvia::RESTORATION_OF_INDEPENDENCE_YEAR - 1) ); } @@ -52,9 +52,9 @@ public function testNotHoliday(): void * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDatesWithHolidayMovedToMonday( + return static::generateRandomDatesWithHolidayMovedToMonday( 5, 4, self::TIMEZONE, @@ -66,13 +66,12 @@ public function holidayDataProvider(): array /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -91,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Latvia::RESTORATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Latvia::RESTORATION_OF_INDEPENDENCE_YEAR), [ self::LOCALE => 'Latvijas Republikas Neatkarības atjaunošanas diena', 'en' => 'Restoration of Independence day', @@ -107,7 +106,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Latvia::RESTORATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Latvia::RESTORATION_OF_INDEPENDENCE_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Latvia/SecondChristmasDayTest.php b/tests/Latvia/SecondChristmasDayTest.php index fdae8694d..5f7359e87 100644 --- a/tests/Latvia/SecondChristmasDayTest.php +++ b/tests/Latvia/SecondChristmasDayTest.php @@ -37,14 +37,12 @@ class SecondChristmasDayTest extends LatviaBaseTestCase implements HolidayTestCa * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Otrie Ziemassvētki'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Latvia/StJohnsDayTest.php b/tests/Latvia/StJohnsDayTest.php index ef4b67988..a3e97299f 100644 --- a/tests/Latvia/StJohnsDayTest.php +++ b/tests/Latvia/StJohnsDayTest.php @@ -37,14 +37,12 @@ class StJohnsDayTest extends LatviaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(6, 24, self::TIMEZONE); + return static::generateRandomDates(6, 24, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Jāņi'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/AllSaintsDayTest.php b/tests/Lithuania/AllSaintsDayTest.php index 5b294923a..6c8efe1d0 100644 --- a/tests/Lithuania/AllSaintsDayTest.php +++ b/tests/Lithuania/AllSaintsDayTest.php @@ -37,14 +37,12 @@ class AllSaintsDayTest extends LithuaniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Visų šventųjų diena (Vėlinės)'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/AllSoulsDayTest.php b/tests/Lithuania/AllSoulsDayTest.php index c1a2973c6..a7a16aedf 100644 --- a/tests/Lithuania/AllSoulsDayTest.php +++ b/tests/Lithuania/AllSoulsDayTest.php @@ -41,7 +41,7 @@ public function testHolidayBeforeAnnounce(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Lithuania::ALL_SOULS_DAY - 1) + static::generateRandomYear(1000, Lithuania::ALL_SOULS_DAY - 1) ); } @@ -52,7 +52,7 @@ public function testHolidayBeforeAnnounce(): void */ public function testHolidayAfterAnnounce(): void { - $year = $this->generateRandomYear(Lithuania::ALL_SOULS_DAY); + $year = static::generateRandomYear(Lithuania::ALL_SOULS_DAY); $this->assertHoliday( self::REGION, @@ -70,7 +70,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::ALL_SOULS_DAY), + static::generateRandomYear(Lithuania::ALL_SOULS_DAY), [self::LOCALE => 'Vėlinės'] ); } @@ -83,7 +83,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::ALL_SOULS_DAY), + static::generateRandomYear(Lithuania::ALL_SOULS_DAY), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Lithuania/AssumptionOfMaryDayTest.php b/tests/Lithuania/AssumptionOfMaryDayTest.php index 17e9ce9c1..cc3d04c9b 100644 --- a/tests/Lithuania/AssumptionOfMaryDayTest.php +++ b/tests/Lithuania/AssumptionOfMaryDayTest.php @@ -37,14 +37,12 @@ class AssumptionOfMaryDayTest extends LithuaniaBaseTestCase implements HolidayTe * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Žolinė (Švč. Mergelės Marijos ėmimo į dangų diena)'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/ChristmasDayTest.php b/tests/Lithuania/ChristmasDayTest.php index 47cf038c6..fa14453c5 100644 --- a/tests/Lithuania/ChristmasDayTest.php +++ b/tests/Lithuania/ChristmasDayTest.php @@ -37,14 +37,12 @@ class ChristmasDayTest extends LithuaniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Šv. Kalėdos'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/ChristmasEveDayTest.php b/tests/Lithuania/ChristmasEveDayTest.php index 6e24f50e5..b26b809e6 100644 --- a/tests/Lithuania/ChristmasEveDayTest.php +++ b/tests/Lithuania/ChristmasEveDayTest.php @@ -37,14 +37,12 @@ class ChristmasEveDayTest extends LithuaniaBaseTestCase implements HolidayTestCa * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(12, 24, self::TIMEZONE); + return static::generateRandomDates(12, 24, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Šv. Kūčios'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/EasterDayTest.php b/tests/Lithuania/EasterDayTest.php index 9c9aee079..8a9d66fc9 100644 --- a/tests/Lithuania/EasterDayTest.php +++ b/tests/Lithuania/EasterDayTest.php @@ -37,21 +37,20 @@ class EasterDayTest extends LithuaniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomEasterDates(self::TIMEZONE); + return static::generateRandomEasterDates(self::TIMEZONE); } /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Velykos'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/EasterMondayDayTest.php b/tests/Lithuania/EasterMondayDayTest.php index 1c699c043..cc415e1de 100644 --- a/tests/Lithuania/EasterMondayDayTest.php +++ b/tests/Lithuania/EasterMondayDayTest.php @@ -37,21 +37,20 @@ class EasterMondayDayTest extends LithuaniaBaseTestCase implements HolidayTestCa * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomEasterMondayDates(self::TIMEZONE); + return static::generateRandomEasterMondayDates(self::TIMEZONE); } /** * Test defined holiday in the test. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Antroji Velykų diena'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/FathersDayTest.php b/tests/Lithuania/FathersDayTest.php index 448d37572..9e6931c8b 100644 --- a/tests/Lithuania/FathersDayTest.php +++ b/tests/Lithuania/FathersDayTest.php @@ -40,7 +40,7 @@ class FathersDayTest extends LithuaniaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -57,13 +57,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Tėvo dieną'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), ['en' => 'Father’s Day'] ); } @@ -76,7 +76,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Lithuania/InternationalWorkersDayTest.php b/tests/Lithuania/InternationalWorkersDayTest.php index 99f6ae7b7..6d116f8da 100644 --- a/tests/Lithuania/InternationalWorkersDayTest.php +++ b/tests/Lithuania/InternationalWorkersDayTest.php @@ -37,14 +37,12 @@ class InternationalWorkersDayTest extends LithuaniaBaseTestCase implements Holid * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Tarptautinė darbo diena'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/LithuaniaTest.php b/tests/Lithuania/LithuaniaTest.php index 8e453a620..ac6e24e2a 100644 --- a/tests/Lithuania/LithuaniaTest.php +++ b/tests/Lithuania/LithuaniaTest.php @@ -49,7 +49,7 @@ public function testOfficialHolidays(): void 'secondChristmasDay', ]; - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); if ($year >= Lithuania::RESTORATION_OF_THE_STATE_YEAR) { $holidays[] = 'restorationOfTheStateOfLithuaniaDay'; @@ -73,7 +73,7 @@ public function testOfficialHolidays(): void */ public function testObservedHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** @@ -83,7 +83,7 @@ public function testObservedHolidays(): void */ public function testSeasonalHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_SEASON); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_SEASON); } /** @@ -93,7 +93,7 @@ public function testSeasonalHolidays(): void */ public function testBankHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_BANK); } /** @@ -103,7 +103,7 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** diff --git a/tests/Lithuania/MothersDayTest.php b/tests/Lithuania/MothersDayTest.php index a5aaa0e37..9562d58f4 100644 --- a/tests/Lithuania/MothersDayTest.php +++ b/tests/Lithuania/MothersDayTest.php @@ -40,7 +40,7 @@ class MothersDayTest extends LithuaniaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -57,13 +57,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Motinos dieną'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), ['en' => 'Mother’s Day'] ); } @@ -76,7 +76,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Lithuania/NewYearsDayTest.php b/tests/Lithuania/NewYearsDayTest.php index 71db2cad8..499f362ed 100644 --- a/tests/Lithuania/NewYearsDayTest.php +++ b/tests/Lithuania/NewYearsDayTest.php @@ -37,14 +37,12 @@ class NewYearsDayTest extends LithuaniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Naujųjų metų diena'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/RestorationOfIndependenceOfLithuaniaDayTest.php b/tests/Lithuania/RestorationOfIndependenceOfLithuaniaDayTest.php index 30256c960..3a35346a5 100644 --- a/tests/Lithuania/RestorationOfIndependenceOfLithuaniaDayTest.php +++ b/tests/Lithuania/RestorationOfIndependenceOfLithuaniaDayTest.php @@ -43,7 +43,7 @@ public function testHolidayBeforeRestoration(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Lithuania::RESTORATION_OF_INDEPENDENCE_YEAR - 1) + static::generateRandomYear(1000, Lithuania::RESTORATION_OF_INDEPENDENCE_YEAR - 1) ); } @@ -54,7 +54,7 @@ public function testHolidayBeforeRestoration(): void */ public function testHolidayAfterRestoration(): void { - $year = $this->generateRandomYear(Lithuania::RESTORATION_OF_INDEPENDENCE_YEAR); + $year = static::generateRandomYear(Lithuania::RESTORATION_OF_INDEPENDENCE_YEAR); $this->assertHoliday( self::REGION, @@ -72,13 +72,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::RESTORATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Lithuania::RESTORATION_OF_INDEPENDENCE_YEAR), [self::LOCALE => 'Lietuvos nepriklausomybės atkūrimo diena'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::RESTORATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Lithuania::RESTORATION_OF_INDEPENDENCE_YEAR), ['en' => 'Day of Restoration of Independence of Lithuania'] ); } @@ -91,7 +91,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::RESTORATION_OF_INDEPENDENCE_YEAR), + static::generateRandomYear(Lithuania::RESTORATION_OF_INDEPENDENCE_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Lithuania/RestorationOfTheStateOfLithuaniaDayTest.php b/tests/Lithuania/RestorationOfTheStateOfLithuaniaDayTest.php index 051c891a4..37aac7757 100644 --- a/tests/Lithuania/RestorationOfTheStateOfLithuaniaDayTest.php +++ b/tests/Lithuania/RestorationOfTheStateOfLithuaniaDayTest.php @@ -43,7 +43,7 @@ public function testHolidayBeforeRestoration(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Lithuania::RESTORATION_OF_THE_STATE_YEAR - 1) + static::generateRandomYear(1000, Lithuania::RESTORATION_OF_THE_STATE_YEAR - 1) ); } @@ -54,7 +54,7 @@ public function testHolidayBeforeRestoration(): void */ public function testHolidayAfterRestoration(): void { - $year = $this->generateRandomYear(Lithuania::RESTORATION_OF_THE_STATE_YEAR); + $year = static::generateRandomYear(Lithuania::RESTORATION_OF_THE_STATE_YEAR); $this->assertHoliday( self::REGION, @@ -72,13 +72,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::RESTORATION_OF_THE_STATE_YEAR), + static::generateRandomYear(Lithuania::RESTORATION_OF_THE_STATE_YEAR), [self::LOCALE => 'Lietuvos valstybės atkūrimo diena'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::RESTORATION_OF_THE_STATE_YEAR), + static::generateRandomYear(Lithuania::RESTORATION_OF_THE_STATE_YEAR), ['en' => 'Day of Restoration of the State of Lithuania'] ); } @@ -91,7 +91,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::RESTORATION_OF_THE_STATE_YEAR), + static::generateRandomYear(Lithuania::RESTORATION_OF_THE_STATE_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Lithuania/SecondChristmasDayTest.php b/tests/Lithuania/SecondChristmasDayTest.php index bb7f33222..b9389ad98 100644 --- a/tests/Lithuania/SecondChristmasDayTest.php +++ b/tests/Lithuania/SecondChristmasDayTest.php @@ -37,14 +37,12 @@ class SecondChristmasDayTest extends LithuaniaBaseTestCase implements HolidayTes * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Kalėdos (antra diena)'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/StJohnsDayTest.php b/tests/Lithuania/StJohnsDayTest.php index d755d68fc..80c20df32 100644 --- a/tests/Lithuania/StJohnsDayTest.php +++ b/tests/Lithuania/StJohnsDayTest.php @@ -37,14 +37,12 @@ class StJohnsDayTest extends LithuaniaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(6, 24, self::TIMEZONE); + return static::generateRandomDates(6, 24, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Rasos ir Joninių diena'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Lithuania/StatehoodDayTest.php b/tests/Lithuania/StatehoodDayTest.php index b974b1991..50870aa39 100644 --- a/tests/Lithuania/StatehoodDayTest.php +++ b/tests/Lithuania/StatehoodDayTest.php @@ -43,7 +43,7 @@ public function testHolidayBeforeRestoration(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Lithuania::STATEHOOD_YEAR - 1) + static::generateRandomYear(1000, Lithuania::STATEHOOD_YEAR - 1) ); } @@ -54,7 +54,7 @@ public function testHolidayBeforeRestoration(): void */ public function testHolidayAfterRestoration(): void { - $year = $this->generateRandomYear(Lithuania::STATEHOOD_YEAR); + $year = static::generateRandomYear(Lithuania::STATEHOOD_YEAR); $this->assertHoliday( self::REGION, @@ -72,13 +72,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::STATEHOOD_YEAR), + static::generateRandomYear(Lithuania::STATEHOOD_YEAR), [self::LOCALE => 'Valstybės (Lietuvos karaliaus Mindaugo karūnavimo) diena'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::STATEHOOD_YEAR), + static::generateRandomYear(Lithuania::STATEHOOD_YEAR), ['en' => 'Statehood Day (Lithuania)'] ); } @@ -91,7 +91,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Lithuania::STATEHOOD_YEAR), + static::generateRandomYear(Lithuania::STATEHOOD_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Luxembourg/AllSaintsDayTest.php b/tests/Luxembourg/AllSaintsDayTest.php index 717ea4215..662b17b05 100644 --- a/tests/Luxembourg/AllSaintsDayTest.php +++ b/tests/Luxembourg/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends LuxembourgBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Toussaint'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Luxembourg/AscensionDayTest.php b/tests/Luxembourg/AscensionDayTest.php index faf14f351..1426a32fc 100644 --- a/tests/Luxembourg/AscensionDayTest.php +++ b/tests/Luxembourg/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ascension'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Luxembourg/AssumptionOfMaryTest.php b/tests/Luxembourg/AssumptionOfMaryTest.php index c989d165b..101ef4fc2 100644 --- a/tests/Luxembourg/AssumptionOfMaryTest.php +++ b/tests/Luxembourg/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends LuxembourgBaseTestCase implements HolidayTest /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Assomption'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Luxembourg/ChristmasDayTest.php b/tests/Luxembourg/ChristmasDayTest.php index 149c063c2..aec628d75 100644 --- a/tests/Luxembourg/ChristmasDayTest.php +++ b/tests/Luxembourg/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends LuxembourgBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Noël'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Luxembourg/EasterMondayTest.php b/tests/Luxembourg/EasterMondayTest.php index 4c3ad81ba..d8bba5cc1 100644 --- a/tests/Luxembourg/EasterMondayTest.php +++ b/tests/Luxembourg/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pâques'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Luxembourg/EuropeDayTest.php b/tests/Luxembourg/EuropeDayTest.php index e1abd7244..a9ab55482 100644 --- a/tests/Luxembourg/EuropeDayTest.php +++ b/tests/Luxembourg/EuropeDayTest.php @@ -42,7 +42,7 @@ class EuropeDayTest extends LuxembourgBaseTestCase implements HolidayTestCase */ public function testEuropeDayOnAfter2019(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testEuropeDayBefore2019(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'La Journée de l’Europe'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Luxembourg/InternationalWorkersDayTest.php b/tests/Luxembourg/InternationalWorkersDayTest.php index fc20f8f4b..fe00f83c6 100644 --- a/tests/Luxembourg/InternationalWorkersDayTest.php +++ b/tests/Luxembourg/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends LuxembourgBaseTestCase implements Holi /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fête du Travail'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Luxembourg/LuxembourgTest.php b/tests/Luxembourg/LuxembourgTest.php index bbbdc9c5d..ff582829a 100644 --- a/tests/Luxembourg/LuxembourgTest.php +++ b/tests/Luxembourg/LuxembourgTest.php @@ -51,7 +51,7 @@ public function testOfficialHolidays(): void 'secondChristmasDay', ]; - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); if ($year >= Luxembourg::EUROPE_DAY_START_YEAR) { $holidays[] = 'europeDay'; @@ -67,7 +67,7 @@ public function testOfficialHolidays(): void */ public function testObservedHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** @@ -77,7 +77,7 @@ public function testObservedHolidays(): void */ public function testSeasonalHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_SEASON); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_SEASON); } /** @@ -87,7 +87,7 @@ public function testSeasonalHolidays(): void */ public function testBankHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_BANK); } /** @@ -97,7 +97,7 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** diff --git a/tests/Luxembourg/NationalDayTest.php b/tests/Luxembourg/NationalDayTest.php index a6aeac4b6..d911a3934 100644 --- a/tests/Luxembourg/NationalDayTest.php +++ b/tests/Luxembourg/NationalDayTest.php @@ -33,11 +33,10 @@ class NationalDayTest extends LuxembourgBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(6, 23, self::TIMEZONE); + return static::generateRandomDates(6, 23, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'La Fête nationale'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Luxembourg/NewYearsDayTest.php b/tests/Luxembourg/NewYearsDayTest.php index d93b94636..bae8397b0 100644 --- a/tests/Luxembourg/NewYearsDayTest.php +++ b/tests/Luxembourg/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends LuxembourgBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Jour de l’An'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Luxembourg/PentecostMondayTest.php b/tests/Luxembourg/PentecostMondayTest.php index a439b846a..31ef7d023 100644 --- a/tests/Luxembourg/PentecostMondayTest.php +++ b/tests/Luxembourg/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pentecôte'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Luxembourg/SecondChristmasDayTest.php b/tests/Luxembourg/SecondChristmasDayTest.php index e54522a6c..5320bb30d 100644 --- a/tests/Luxembourg/SecondChristmasDayTest.php +++ b/tests/Luxembourg/SecondChristmasDayTest.php @@ -33,11 +33,10 @@ class SecondChristmasDayTest extends LuxembourgBaseTestCase implements HolidayTe /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Deuxième jour de Noël'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Mexico/AllSaintsDayTest.php b/tests/Mexico/AllSaintsDayTest.php index 692995a59..d7f90e36e 100644 --- a/tests/Mexico/AllSaintsDayTest.php +++ b/tests/Mexico/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends MexicoBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Día de todos los Santos'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Mexico/AssumptionOfMaryTest.php b/tests/Mexico/AssumptionOfMaryTest.php index 74eb61a9a..694d387b0 100644 --- a/tests/Mexico/AssumptionOfMaryTest.php +++ b/tests/Mexico/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends MexicoBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Asunción de la Virgen María'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Mexico/BenitoJuarezBirthdayTest.php b/tests/Mexico/BenitoJuarezBirthdayTest.php index e67ec227b..58614d0b5 100644 --- a/tests/Mexico/BenitoJuarezBirthdayTest.php +++ b/tests/Mexico/BenitoJuarezBirthdayTest.php @@ -55,7 +55,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Natalicio de Benito Juárez'] ); } @@ -67,6 +67,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Mexico/ChristmasTest.php b/tests/Mexico/ChristmasTest.php index 0d3b4fcb3..c955bdea5 100644 --- a/tests/Mexico/ChristmasTest.php +++ b/tests/Mexico/ChristmasTest.php @@ -33,11 +33,10 @@ class ChristmasTest extends MexicoBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Navidad'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Mexico/EasterMondayTest.php b/tests/Mexico/EasterMondayTest.php index daa131eaf..8d1de30da 100644 --- a/tests/Mexico/EasterMondayTest.php +++ b/tests/Mexico/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lunes de Pascua'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Mexico/EpiphanyTest.php b/tests/Mexico/EpiphanyTest.php index f9e093f5e..e9d7dcfeb 100644 --- a/tests/Mexico/EpiphanyTest.php +++ b/tests/Mexico/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends MexicoBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Día de Reyes'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Mexico/GoodFridayTest.php b/tests/Mexico/GoodFridayTest.php index feec64bc9..cdc682dcf 100644 --- a/tests/Mexico/GoodFridayTest.php +++ b/tests/Mexico/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Viernes Santo'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Mexico/ImmaculateConceptionTest.php b/tests/Mexico/ImmaculateConceptionTest.php index 0f6af4123..5a6ce8b96 100644 --- a/tests/Mexico/ImmaculateConceptionTest.php +++ b/tests/Mexico/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends MexicoBaseTestCase implements HolidayTest /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Inmaculada Concepción'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Mexico/IndependenceDayTest.php b/tests/Mexico/IndependenceDayTest.php index 50624e7a6..fbe96c334 100644 --- a/tests/Mexico/IndependenceDayTest.php +++ b/tests/Mexico/IndependenceDayTest.php @@ -69,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de la Independencia'] ); } @@ -81,6 +81,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Mexico/InternationalWorkersDayTest.php b/tests/Mexico/InternationalWorkersDayTest.php index 3d63f4b12..0985e4de5 100644 --- a/tests/Mexico/InternationalWorkersDayTest.php +++ b/tests/Mexico/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends MexicoBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Día del Trabajador'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Mexico/NewYearsDayTest.php b/tests/Mexico/NewYearsDayTest.php index dbe9af245..4310596d5 100644 --- a/tests/Mexico/NewYearsDayTest.php +++ b/tests/Mexico/NewYearsDayTest.php @@ -30,11 +30,10 @@ class NewYearsDayTest extends MexicoBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -47,9 +46,9 @@ public function testNewYearsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -62,7 +61,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Año Nuevo'] ); } @@ -74,6 +73,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Mexico/VirginOfGuadalupeTest.php b/tests/Mexico/VirginOfGuadalupeTest.php index 8c602c8f3..3c8f4cdda 100644 --- a/tests/Mexico/VirginOfGuadalupeTest.php +++ b/tests/Mexico/VirginOfGuadalupeTest.php @@ -58,7 +58,7 @@ public function testVirginOfGuadalupe(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Día de la Virgen de Guadalupe']); } @@ -69,7 +69,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Netherlands/AscensionDayTest.php b/tests/Netherlands/AscensionDayTest.php index 6729a7002..3766aa508 100644 --- a/tests/Netherlands/AscensionDayTest.php +++ b/tests/Netherlands/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Hemelvaart'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Netherlands/AshWednesdayTest.php b/tests/Netherlands/AshWednesdayTest.php index fc765c9a5..881a6d1a0 100644 --- a/tests/Netherlands/AshWednesdayTest.php +++ b/tests/Netherlands/AshWednesdayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Aswoensdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Netherlands/ChristmasDayTest.php b/tests/Netherlands/ChristmasDayTest.php index 6491e7328..272f0ec94 100644 --- a/tests/Netherlands/ChristmasDayTest.php +++ b/tests/Netherlands/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends NetherlandsBaseTestCase implements HolidayTestCas /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'eerste kerstdag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Netherlands/CommemorationDayTest.php b/tests/Netherlands/CommemorationDayTest.php index 6a4ed04cd..322eeeccc 100644 --- a/tests/Netherlands/CommemorationDayTest.php +++ b/tests/Netherlands/CommemorationDayTest.php @@ -45,7 +45,7 @@ public function testCommemorationDayBefore1947(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'dodenherdenking'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OBSERVANCE ); } diff --git a/tests/Netherlands/EasterMondayTest.php b/tests/Netherlands/EasterMondayTest.php index 78caea3d2..348fad6a6 100644 --- a/tests/Netherlands/EasterMondayTest.php +++ b/tests/Netherlands/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'tweede paasdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Netherlands/EasterTest.php b/tests/Netherlands/EasterTest.php index 35212d533..dbe54128b 100644 --- a/tests/Netherlands/EasterTest.php +++ b/tests/Netherlands/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'eerste paasdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Netherlands/EpiphanyTest.php b/tests/Netherlands/EpiphanyTest.php index c506a4d12..d1692198c 100644 --- a/tests/Netherlands/EpiphanyTest.php +++ b/tests/Netherlands/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends NetherlandsBaseTestCase implements HolidayTestCase /** * Tests Epiphany. * - * @dataProvider EpiphanyDataProvider - * * @param int $year the year for which Epiphany needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('EpiphanyDataProvider')] public function testEpiphany(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testEpiphany(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function EpiphanyDataProvider(): array + public static function EpiphanyDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Drie Koningen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Netherlands/FathersDayTest.php b/tests/Netherlands/FathersDayTest.php index f4e9f16c8..1a09ce9bb 100644 --- a/tests/Netherlands/FathersDayTest.php +++ b/tests/Netherlands/FathersDayTest.php @@ -37,7 +37,7 @@ class FathersDayTest extends NetherlandsBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vaderdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Netherlands/GoodFridayTest.php b/tests/Netherlands/GoodFridayTest.php index 2055afaf3..688ba2a46 100644 --- a/tests/Netherlands/GoodFridayTest.php +++ b/tests/Netherlands/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Goede Vrijdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Netherlands/HalloweenTest.php b/tests/Netherlands/HalloweenTest.php index d32293545..28d6f09fc 100644 --- a/tests/Netherlands/HalloweenTest.php +++ b/tests/Netherlands/HalloweenTest.php @@ -33,11 +33,10 @@ class HalloweenTest extends NetherlandsBaseTestCase implements HolidayTestCase /** * Tests Halloween. * - * @dataProvider HalloweenDataProvider - * * @param int $year the year for which Halloween needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HalloweenDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HalloweenDataProvider(): array + public static function HalloweenDataProvider(): array { - return $this->generateRandomDates(10, 31, self::TIMEZONE); + return static::generateRandomDates(10, 31, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Halloween'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Netherlands/InternationalWorkersDayTest.php b/tests/Netherlands/InternationalWorkersDayTest.php index a4d5df30c..c8dc80eda 100644 --- a/tests/Netherlands/InternationalWorkersDayTest.php +++ b/tests/Netherlands/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends NetherlandsBaseTestCase implements Hol /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testInternationalWorkersDay(int $year, \DateTimeInterface $expec * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Dag van de arbeid'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Netherlands/KingsDayTest.php b/tests/Netherlands/KingsDayTest.php index da222fbf4..4ca433c57 100644 --- a/tests/Netherlands/KingsDayTest.php +++ b/tests/Netherlands/KingsDayTest.php @@ -77,7 +77,7 @@ public function testKingsDayBefore2014(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -91,7 +91,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Koningsdag'] ); } @@ -106,7 +106,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Netherlands/LiberationDayTest.php b/tests/Netherlands/LiberationDayTest.php index 7d80f9dad..a8874d82f 100644 --- a/tests/Netherlands/LiberationDayTest.php +++ b/tests/Netherlands/LiberationDayTest.php @@ -45,7 +45,7 @@ public function testLiberationDayBefore1947(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -56,7 +56,7 @@ public function testLiberationDayBefore1947(): void */ public function testLiberationDayOnAfter1947(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Bevrijdingsdag'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(2001, 2004), + static::generateRandomYear(2001, 2004), Holiday::TYPE_OBSERVANCE ); diff --git a/tests/Netherlands/MothersDayTest.php b/tests/Netherlands/MothersDayTest.php index 8d6ba6838..20c9c4086 100644 --- a/tests/Netherlands/MothersDayTest.php +++ b/tests/Netherlands/MothersDayTest.php @@ -37,7 +37,7 @@ class MothersDayTest extends NetherlandsBaseTestCase implements HolidayTestCase */ public function testMothersDay(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Moederdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Netherlands/NetherlandsTest.php b/tests/Netherlands/NetherlandsTest.php index 5d9791112..e03dc5af4 100644 --- a/tests/Netherlands/NetherlandsTest.php +++ b/tests/Netherlands/NetherlandsTest.php @@ -37,7 +37,7 @@ class NetherlandsTest extends NetherlandsBaseTestCase implements ProviderTestCas */ protected function setUp(): void { - $this->year = $this->generateRandomYear(2014); + $this->year = static::generateRandomYear(2014); } /** @@ -80,7 +80,7 @@ public function testObservedHolidays(): void $this->assertDefinedHolidays([ 'liberationDay', - ], self::REGION, $this->generateRandomYear(2011, 2014), Holiday::TYPE_OBSERVANCE); + ], self::REGION, static::generateRandomYear(2011, 2014), Holiday::TYPE_OBSERVANCE); } /** diff --git a/tests/Netherlands/NewYearsDayTest.php b/tests/Netherlands/NewYearsDayTest.php index 30af89a5b..0a1de82ae 100644 --- a/tests/Netherlands/NewYearsDayTest.php +++ b/tests/Netherlands/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends NetherlandsBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testNewYearsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nieuwjaar'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Netherlands/PentecostTest.php b/tests/Netherlands/PentecostTest.php index 334dcba1a..990843040 100644 --- a/tests/Netherlands/PentecostTest.php +++ b/tests/Netherlands/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'eerste pinksterdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Netherlands/QueensDayTest.php b/tests/Netherlands/QueensDayTest.php index 983fd305a..96291f75d 100644 --- a/tests/Netherlands/QueensDayTest.php +++ b/tests/Netherlands/QueensDayTest.php @@ -117,7 +117,7 @@ public function testQueensBetween1949and2013SubstitutedEarlier(): void */ public function testQueensDayBefore1891(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(1000, 1890)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(1000, 1890)); } /** @@ -127,7 +127,7 @@ public function testQueensDayBefore1891(): void */ public function testQueensDayAfter2013(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(2014)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(2014)); } /** @@ -140,7 +140,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1891, 2013), + static::generateRandomYear(1891, 2013), [self::LOCALE => 'Koninginnedag'] ); } @@ -155,7 +155,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1891, 2013), + static::generateRandomYear(1891, 2013), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Netherlands/ValentinesDayTest.php b/tests/Netherlands/ValentinesDayTest.php index 167942902..f78c60f8b 100644 --- a/tests/Netherlands/ValentinesDayTest.php +++ b/tests/Netherlands/ValentinesDayTest.php @@ -33,11 +33,10 @@ class ValentinesDayTest extends NetherlandsBaseTestCase implements HolidayTestCa /** * Tests Valentines Day. * - * @dataProvider ValentinesDayDataProvider - * * @param int $year the year for which Valentines Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ValentinesDayDataProvider')] public function testValentinesDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testValentinesDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ValentinesDayDataProvider(): array + public static function ValentinesDayDataProvider(): array { - return $this->generateRandomDates(2, 14, self::TIMEZONE); + return static::generateRandomDates(2, 14, self::TIMEZONE); } /** @@ -62,7 +61,7 @@ public function ValentinesDayDataProvider(): array */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,7 +74,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Valentijnsdag'] ); } diff --git a/tests/Netherlands/WorldAnimalDayTest.php b/tests/Netherlands/WorldAnimalDayTest.php index 1fd437749..0d7fc32be 100644 --- a/tests/Netherlands/WorldAnimalDayTest.php +++ b/tests/Netherlands/WorldAnimalDayTest.php @@ -42,7 +42,7 @@ class WorldAnimalDayTest extends NetherlandsBaseTestCase implements HolidayTestC */ public function testWorldAnimalDayOnAfter1931(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testWorldAnimalBefore1931(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OTHER ); } @@ -90,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Werelddierendag'] ); } diff --git a/tests/Netherlands/carnivalDayTest.php b/tests/Netherlands/carnivalDayTest.php index 609fb5e1b..5cdfa7e6f 100644 --- a/tests/Netherlands/carnivalDayTest.php +++ b/tests/Netherlands/carnivalDayTest.php @@ -53,7 +53,7 @@ public function testHoliday(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** @@ -66,7 +66,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Carnaval'] ); } diff --git a/tests/Netherlands/pentecostMondayTest.php b/tests/Netherlands/pentecostMondayTest.php index 6e9c5f963..891bf3828 100644 --- a/tests/Netherlands/pentecostMondayTest.php +++ b/tests/Netherlands/pentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'tweede pinksterdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Netherlands/princesDayTest.php b/tests/Netherlands/princesDayTest.php index aeac99ebf..a5036ff7e 100644 --- a/tests/Netherlands/princesDayTest.php +++ b/tests/Netherlands/princesDayTest.php @@ -37,7 +37,7 @@ class princesDayTest extends NetherlandsBaseTestCase implements HolidayTestCase */ public function testPrincesDay(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Prinsjesdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Netherlands/secondCarnivalDay.php b/tests/Netherlands/secondCarnivalDay.php index 7e0134c7a..7a35d8e58 100644 --- a/tests/Netherlands/secondCarnivalDay.php +++ b/tests/Netherlands/secondCarnivalDay.php @@ -31,6 +31,11 @@ class secondCarnivalDay extends NetherlandsBaseTestCase implements HolidayTestCa */ public const HOLIDAY = 'secondCarnivalDay'; + public function __construct() + { + parent::__construct(static::class); + } + /** * Tests the holiday defined in this test. * @@ -60,7 +65,7 @@ public function testHoliday(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** @@ -76,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Carnaval'] ); } diff --git a/tests/Netherlands/secondChristmasdayTest.php b/tests/Netherlands/secondChristmasdayTest.php index 3a1214b1b..96c31f5f4 100644 --- a/tests/Netherlands/secondChristmasdayTest.php +++ b/tests/Netherlands/secondChristmasdayTest.php @@ -33,11 +33,10 @@ class secondChristmasdayTest extends NetherlandsBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'tweede kerstdag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Netherlands/stMartinsDayTest.php b/tests/Netherlands/stMartinsDayTest.php index 5de31f291..b51c74cb9 100644 --- a/tests/Netherlands/stMartinsDayTest.php +++ b/tests/Netherlands/stMartinsDayTest.php @@ -33,11 +33,10 @@ class stMartinsDayTest extends NetherlandsBaseTestCase implements HolidayTestCas /** * Tests Sint Martins Day. * - * @dataProvider stMartinsDayDataProvider - * * @param int $year the year for which Sint Martins Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('stMartinsDayDataProvider')] public function teststMartinsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function teststMartinsDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function stMartinsDayDataProvider(): array + public static function stMartinsDayDataProvider(): array { - return $this->generateRandomDates(11, 11, self::TIMEZONE); + return static::generateRandomDates(11, 11, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Sint Maarten'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Netherlands/stNicholasDayTest.php b/tests/Netherlands/stNicholasDayTest.php index c3f48a474..6cf4b01d4 100644 --- a/tests/Netherlands/stNicholasDayTest.php +++ b/tests/Netherlands/stNicholasDayTest.php @@ -33,11 +33,10 @@ class stNicholasDayTest extends NetherlandsBaseTestCase implements HolidayTestCa /** * Tests Sint Nicholas Day. * - * @dataProvider stNicholasDayDataProvider - * * @param int $year the year for which Sint Nicholas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('stNicholasDayDataProvider')] public function teststNicholasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function teststNicholasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function stNicholasDayDataProvider(): array + public static function stNicholasDayDataProvider(): array { - return $this->generateRandomDates(12, 5, self::TIMEZONE); + return static::generateRandomDates(12, 5, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Sinterklaas'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Netherlands/thirdCarnivalDay.php b/tests/Netherlands/thirdCarnivalDay.php index 8da7ad125..f8233788b 100644 --- a/tests/Netherlands/thirdCarnivalDay.php +++ b/tests/Netherlands/thirdCarnivalDay.php @@ -31,6 +31,11 @@ class thirdCarnivalDay extends NetherlandsBaseTestCase implements HolidayTestCas */ public const HOLIDAY = 'thirdCarnivalDay'; + public function __construct() + { + parent::__construct(static::class); + } + /** * Tests the holiday defined in this test. * @@ -60,7 +65,7 @@ public function testHoliday(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** @@ -76,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Carnaval'] ); } diff --git a/tests/NewZealand/AnzacDayTest.php b/tests/NewZealand/AnzacDayTest.php index 429130331..d5d5306bd 100644 --- a/tests/NewZealand/AnzacDayTest.php +++ b/tests/NewZealand/AnzacDayTest.php @@ -38,13 +38,12 @@ class AnzacDayTest extends NewZealandBaseTestCase implements HolidayTestCase /** * Tests ANZAC 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -70,15 +69,15 @@ public function testNotHoliday(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDatesWithModifier(4, 25, function ($year, \DateTime $date): void { + return static::generateRandomDatesWithModifier(4, 25, function ($year, \DateTime $date): void { // in 2015 some policy was introduced to make sure this holiday was celebrated during the working week. if ($year < 2015) { return; } - if (! $this->isWeekend($date)) { + if (! static::isWeekend($date)) { return; } @@ -96,7 +95,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'ANZAC Day'] ); } @@ -111,7 +110,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/NewZealand/BoxingDayTest.php b/tests/NewZealand/BoxingDayTest.php index de39f0e56..96c1c2acd 100644 --- a/tests/NewZealand/BoxingDayTest.php +++ b/tests/NewZealand/BoxingDayTest.php @@ -33,13 +33,12 @@ class BoxingDayTest extends NewZealandBaseTestCase implements HolidayTestCase /** * 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 * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,12 +56,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-26", new \DateTimeZone(self::TIMEZONE)); if (\in_array((int) $date->format('w'), [0, 6], true)) { @@ -85,7 +84,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Boxing Day'] ); } @@ -97,6 +96,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/NewZealand/ChristmasDayTest.php b/tests/NewZealand/ChristmasDayTest.php index 20f37213b..1e7a5df0b 100644 --- a/tests/NewZealand/ChristmasDayTest.php +++ b/tests/NewZealand/ChristmasDayTest.php @@ -33,13 +33,12 @@ class ChristmasDayTest extends NewZealandBaseTestCase implements HolidayTestCase /** * 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 * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,12 +56,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-25", new \DateTimeZone(self::TIMEZONE)); if (\in_array((int) $date->format('w'), [0, 6], true)) { @@ -85,7 +84,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); } @@ -97,6 +96,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/NewZealand/DayAfterNewYearsDayTest.php b/tests/NewZealand/DayAfterNewYearsDayTest.php index d9ab2bc02..cae5cb7cf 100644 --- a/tests/NewZealand/DayAfterNewYearsDayTest.php +++ b/tests/NewZealand/DayAfterNewYearsDayTest.php @@ -33,13 +33,12 @@ class DayAfterNewYearsDayTest extends NewZealandBaseTestCase implements HolidayT /** * Tests Day After New Years Day. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -60,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Day after New Year’s Day'] ); } @@ -72,7 +71,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -82,12 +81,12 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-01-02", new \DateTimeZone(self::TIMEZONE)); switch ($date->format('w')) { diff --git a/tests/NewZealand/EasterMondayTest.php b/tests/NewZealand/EasterMondayTest.php index ff1c988a0..85aeaf06d 100644 --- a/tests/NewZealand/EasterMondayTest.php +++ b/tests/NewZealand/EasterMondayTest.php @@ -33,13 +33,12 @@ class EasterMondayTest extends NewZealandBaseTestCase implements HolidayTestCase /** * Tests Easter Monday. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->add(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Monday'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/NewZealand/GoodFridayTest.php b/tests/NewZealand/GoodFridayTest.php index 86475f063..f75621278 100644 --- a/tests/NewZealand/GoodFridayTest.php +++ b/tests/NewZealand/GoodFridayTest.php @@ -33,13 +33,12 @@ class GoodFridayTest extends NewZealandBaseTestCase implements HolidayTestCase /** * Tests Good Friday. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->sub(new \DateInterval('P2D')); $data[] = [$year, $date->format('Y-m-d')]; } @@ -81,7 +80,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Good Friday'] ); } @@ -93,6 +92,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/NewZealand/LabourDayTest.php b/tests/NewZealand/LabourDayTest.php index c773447ab..37c89b065 100644 --- a/tests/NewZealand/LabourDayTest.php +++ b/tests/NewZealand/LabourDayTest.php @@ -38,13 +38,12 @@ class LabourDayTest extends NewZealandBaseTestCase implements HolidayTestCase /** * 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -70,12 +69,12 @@ public function testNotHoliday(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 100; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $expected = new \DateTime( (($year < 1910) ? 'second wednesday of october' : 'fourth monday of october') . " {$year}", new \DateTimeZone(self::TIMEZONE) @@ -97,7 +96,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Labour Day'] ); } @@ -112,7 +111,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/NewZealand/MatarikiTest.php b/tests/NewZealand/MatarikiTest.php index fb8d125df..ae63df6e8 100644 --- a/tests/NewZealand/MatarikiTest.php +++ b/tests/NewZealand/MatarikiTest.php @@ -43,11 +43,10 @@ class MatarikiTest extends NewZealandBaseTestCase implements HolidayTestCase /** * Tests Matariki. * - * @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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -68,7 +67,7 @@ public function testNotHoliday(): void * * @throws Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; @@ -107,7 +106,7 @@ public function HolidayDataProvider(): array ]; for ($y = 1; $y <= 100; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::CALCULATED_UNTIL_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::CALCULATED_UNTIL_YEAR); $expected = new \DateTime( sprintf('%04d-%02d-%02d', $year, $matarikiDates[$year]['month'], $matarikiDates[$year]['day']), new \DateTimeZone(self::TIMEZONE) @@ -128,7 +127,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::CALCULATED_UNTIL_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::CALCULATED_UNTIL_YEAR), [self::LOCALE => 'Matariki'] ); } @@ -143,7 +142,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::CALCULATED_UNTIL_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::CALCULATED_UNTIL_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/NewZealand/NewYearsDayTest.php b/tests/NewZealand/NewYearsDayTest.php index f7fc232db..562120792 100644 --- a/tests/NewZealand/NewYearsDayTest.php +++ b/tests/NewZealand/NewYearsDayTest.php @@ -33,13 +33,12 @@ class NewYearsDayTest extends NewZealandBaseTestCase implements HolidayTestCase /** * 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 * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,12 +56,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-01-01", new \DateTimeZone(self::TIMEZONE)); switch ($date->format('w')) { @@ -90,7 +89,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'New Year’s Day'] ); } @@ -102,6 +101,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/NewZealand/NewZealandTest.php b/tests/NewZealand/NewZealandTest.php index ced8f19c0..ca210c716 100644 --- a/tests/NewZealand/NewZealandTest.php +++ b/tests/NewZealand/NewZealandTest.php @@ -37,7 +37,7 @@ class NewZealandTest extends NewZealandBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1987); + $this->year = static::generateRandomYear(1987); } /** diff --git a/tests/NewZealand/QueensBirthdayTest.php b/tests/NewZealand/QueensBirthdayTest.php index c3ae2003b..23feaaab3 100644 --- a/tests/NewZealand/QueensBirthdayTest.php +++ b/tests/NewZealand/QueensBirthdayTest.php @@ -38,11 +38,10 @@ class QueensBirthdayTest extends NewZealandBaseTestCase implements HolidayTestCa /** * Tests Queens Birthday. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -63,12 +62,12 @@ public function testNotHoliday(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 1; $y <= 100; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $expected = new \DateTime("first monday of june {$year}", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $expected]; } @@ -86,7 +85,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Queen’s Birthday'] ); } @@ -101,7 +100,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/NewZealand/WaitangiDayTest.php b/tests/NewZealand/WaitangiDayTest.php index f7693e850..6fad312c1 100644 --- a/tests/NewZealand/WaitangiDayTest.php +++ b/tests/NewZealand/WaitangiDayTest.php @@ -38,13 +38,12 @@ class WaitangiDayTest extends NewZealandBaseTestCase implements HolidayTestCase /** * Tests Waitangi 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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -73,7 +72,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Waitangi Day'] ); } @@ -88,7 +87,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } @@ -100,15 +99,15 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDatesWithModifier(2, 06, function ($year, \DateTime $date): void { + return static::generateRandomDatesWithModifier(2, 06, function ($year, \DateTime $date): void { // in 2015 some policy was introduced to make sure this holiday was celebrated during the working week. if ($year < 2015) { return; } - if (! $this->isWeekend($date)) { + if (! static::isWeekend($date)) { return; } diff --git a/tests/Norway/AscensionDayTest.php b/tests/Norway/AscensionDayTest.php index ac840006a..284a0db54 100644 --- a/tests/Norway/AscensionDayTest.php +++ b/tests/Norway/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Kristi himmelfartsdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Norway/ChristmasDayTest.php b/tests/Norway/ChristmasDayTest.php index 4b7f5911d..2c06b433e 100644 --- a/tests/Norway/ChristmasDayTest.php +++ b/tests/Norway/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends NorwayBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'første juledag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Norway/ConstitutionDayTest.php b/tests/Norway/ConstitutionDayTest.php index 82c970d3d..e1dd3a5a1 100644 --- a/tests/Norway/ConstitutionDayTest.php +++ b/tests/Norway/ConstitutionDayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'grunnlovsdagen'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Norway/EasterMondayTest.php b/tests/Norway/EasterMondayTest.php index 0a241a8bd..1c3af1570 100644 --- a/tests/Norway/EasterMondayTest.php +++ b/tests/Norway/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'andre påskedag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Norway/EasterTest.php b/tests/Norway/EasterTest.php index a8469e0ff..aa6191edf 100644 --- a/tests/Norway/EasterTest.php +++ b/tests/Norway/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'første påskedag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Norway/GoodFridayTest.php b/tests/Norway/GoodFridayTest.php index c89b723a5..a0ce58b38 100644 --- a/tests/Norway/GoodFridayTest.php +++ b/tests/Norway/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'langfredag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Norway/InternationalWorkersDayTest.php b/tests/Norway/InternationalWorkersDayTest.php index 805c10042..7532087bd 100644 --- a/tests/Norway/InternationalWorkersDayTest.php +++ b/tests/Norway/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends NorwayBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'arbeidernes dag'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Norway/MaundyThursdayTest.php b/tests/Norway/MaundyThursdayTest.php index f786b6ac9..39c272f87 100644 --- a/tests/Norway/MaundyThursdayTest.php +++ b/tests/Norway/MaundyThursdayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'skjærtorsdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Norway/NewYearsDayTest.php b/tests/Norway/NewYearsDayTest.php index a26027b34..ef951758d 100644 --- a/tests/Norway/NewYearsDayTest.php +++ b/tests/Norway/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends NorwayBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'første nyttårsdag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Norway/NorwayTest.php b/tests/Norway/NorwayTest.php index 0a840cdf1..0f68df370 100644 --- a/tests/Norway/NorwayTest.php +++ b/tests/Norway/NorwayTest.php @@ -37,7 +37,7 @@ class NorwayTest extends NorwayBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1836); + $this->year = static::generateRandomYear(1836); } /** diff --git a/tests/Norway/PentecostMondayTest.php b/tests/Norway/PentecostMondayTest.php index 2b27328b4..a2934489b 100644 --- a/tests/Norway/PentecostMondayTest.php +++ b/tests/Norway/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'andre pinsedag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Norway/PentecostTest.php b/tests/Norway/PentecostTest.php index 812706214..ef2628de3 100644 --- a/tests/Norway/PentecostTest.php +++ b/tests/Norway/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'første pinsedag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Norway/SecondChristmasDayTest.php b/tests/Norway/SecondChristmasDayTest.php index 606423b65..3698aa4c8 100644 --- a/tests/Norway/SecondChristmasDayTest.php +++ b/tests/Norway/SecondChristmasDayTest.php @@ -33,11 +33,10 @@ class SecondChristmasDayTest extends NorwayBaseTestCase implements HolidayTestCa /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'andre juledag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/AllSaintsDayTest.php b/tests/Poland/AllSaintsDayTest.php index a6e54f4f2..1a6841474 100644 --- a/tests/Poland/AllSaintsDayTest.php +++ b/tests/Poland/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends PolandBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Uroczystość Wszystkich Świętych'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/AssumptionOfMaryTest.php b/tests/Poland/AssumptionOfMaryTest.php index 371381bfd..b2e0bd385 100644 --- a/tests/Poland/AssumptionOfMaryTest.php +++ b/tests/Poland/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends PolandBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Wniebowzięcie Najświętszej Marii Panny'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/ChristmasEveTest.php b/tests/Poland/ChristmasEveTest.php index e70f20aa2..6768af1b4 100644 --- a/tests/Poland/ChristmasEveTest.php +++ b/tests/Poland/ChristmasEveTest.php @@ -37,7 +37,7 @@ class ChristmasEveTest extends PolandBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -51,7 +51,7 @@ public function testHoliday(): void */ public function testNotHoliday(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -65,7 +65,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Wigilia Bożego Narodzenia'] ); } @@ -77,6 +77,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/ChristmasTest.php b/tests/Poland/ChristmasTest.php index 55d42ca40..145e4c5ae 100644 --- a/tests/Poland/ChristmasTest.php +++ b/tests/Poland/ChristmasTest.php @@ -33,11 +33,10 @@ class ChristmasTest extends PolandBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'pierwszy dzień Bożego Narodzenia'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/ConstitutionDayTest.php b/tests/Poland/ConstitutionDayTest.php index f84b1d9b3..0d426f956 100644 --- a/tests/Poland/ConstitutionDayTest.php +++ b/tests/Poland/ConstitutionDayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Święto Narodowe Trzeciego Maja'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Poland/CorpusChristiTest.php b/tests/Poland/CorpusChristiTest.php index a174660cb..444727fbf 100644 --- a/tests/Poland/CorpusChristiTest.php +++ b/tests/Poland/CorpusChristiTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Boże Ciało'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/EasterMondayTest.php b/tests/Poland/EasterMondayTest.php index 481ef0211..6da546e3c 100644 --- a/tests/Poland/EasterMondayTest.php +++ b/tests/Poland/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Poniedziałek Wielkanocny'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/EasterTest.php b/tests/Poland/EasterTest.php index 4deff4928..c90d08dd5 100644 --- a/tests/Poland/EasterTest.php +++ b/tests/Poland/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Wielkanoc'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/EpiphanyTest.php b/tests/Poland/EpiphanyTest.php index 0de9c22ab..7d50ef631 100644 --- a/tests/Poland/EpiphanyTest.php +++ b/tests/Poland/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends PolandBaseTestCase implements HolidayTestCase /** * Tests Epiphany. * - * @dataProvider EpiphanyDataProvider - * * @param int $year the year for which Epiphany needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('EpiphanyDataProvider')] public function testEpiphany(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testEpiphany(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function EpiphanyDataProvider(): array + public static function EpiphanyDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Święto Trzech Króli'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/IndependenceDayTest.php b/tests/Poland/IndependenceDayTest.php index 4a36f920f..574513fbb 100644 --- a/tests/Poland/IndependenceDayTest.php +++ b/tests/Poland/IndependenceDayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Narodowe Święto Niepodległości'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Poland/InternationalWorkersDayTest.php b/tests/Poland/InternationalWorkersDayTest.php index a8b201239..6357e827b 100644 --- a/tests/Poland/InternationalWorkersDayTest.php +++ b/tests/Poland/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends PolandBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Święto Pracy'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Poland/NewYearsDayTest.php b/tests/Poland/NewYearsDayTest.php index 130cf3d3c..7cf563f96 100644 --- a/tests/Poland/NewYearsDayTest.php +++ b/tests/Poland/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends PolandBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nowy Rok'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/PentecostTest.php b/tests/Poland/PentecostTest.php index 61449cae0..6e659d4a1 100644 --- a/tests/Poland/PentecostTest.php +++ b/tests/Poland/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Zielone Świątki'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Poland/PolandTest.php b/tests/Poland/PolandTest.php index ed32101d9..d3e633eb3 100644 --- a/tests/Poland/PolandTest.php +++ b/tests/Poland/PolandTest.php @@ -37,7 +37,7 @@ class PolandTest extends PolandBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1918); + $this->year = static::generateRandomYear(1918); } /** diff --git a/tests/Poland/SecondChristmasDayTest.php b/tests/Poland/SecondChristmasDayTest.php index f2023b5be..bc3cec017 100644 --- a/tests/Poland/SecondChristmasDayTest.php +++ b/tests/Poland/SecondChristmasDayTest.php @@ -33,11 +33,10 @@ class SecondChristmasDayTest extends PolandBaseTestCase implements HolidayTestCa /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'drugi dzień Bożego Narodzenia'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Portugal/AllSaintsDayTest.php b/tests/Portugal/AllSaintsDayTest.php index 6f6a76196..e08b431a1 100644 --- a/tests/Portugal/AllSaintsDayTest.php +++ b/tests/Portugal/AllSaintsDayTest.php @@ -63,7 +63,7 @@ public function testHoliday(): void */ public function testNotHoliday(): void { - $year = $this->generateRandomYear(2013, 2015); + $year = static::generateRandomYear(2013, 2015); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -74,7 +74,7 @@ public function testNotHoliday(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); + $year = static::generateRandomYear(self::HOLIDAY_YEAR_RESTORED); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, @@ -91,11 +91,11 @@ public function testTranslation(): void public function testHolidayType(): void { // After restoration - $year = $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); + $year = static::generateRandomYear(self::HOLIDAY_YEAR_RESTORED); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); // Before abolishment - $year = $this->generateRandomYear(1000, self::HOLIDAY_YEAR_ABOLISHED - 1); + $year = static::generateRandomYear(1000, self::HOLIDAY_YEAR_ABOLISHED - 1); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Portugal/AssumptionOfMaryTest.php b/tests/Portugal/AssumptionOfMaryTest.php index 12a48c6b0..abc464fb9 100644 --- a/tests/Portugal/AssumptionOfMaryTest.php +++ b/tests/Portugal/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends PortugalBaseTestCase implements HolidayTestCa /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Assunção de Nossa Senhora'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Portugal/CarnationRevolutionDayTest.php b/tests/Portugal/CarnationRevolutionDayTest.php index 5016c8d17..b7cb8983a 100644 --- a/tests/Portugal/CarnationRevolutionDayTest.php +++ b/tests/Portugal/CarnationRevolutionDayTest.php @@ -42,7 +42,7 @@ class CarnationRevolutionDayTest extends PortugalBaseTestCase implements Holiday */ public function testHolidayAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $expected = new \DateTime("{$year}-04-25", new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); } @@ -54,7 +54,7 @@ public function testHolidayAfterEstablishment(): void */ public function testNotHolidayBeforeEstablishment(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -65,7 +65,7 @@ public function testNotHolidayBeforeEstablishment(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Dia da Liberdade']); } @@ -76,7 +76,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::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 fccfd7e64..30265b3f6 100644 --- a/tests/Portugal/ChristmasTest.php +++ b/tests/Portugal/ChristmasTest.php @@ -33,11 +33,10 @@ class ChristmasTest extends PortugalBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Natal'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Portugal/CorpusChristiTest.php b/tests/Portugal/CorpusChristiTest.php index 2ebfacb82..b0edaecaa 100644 --- a/tests/Portugal/CorpusChristiTest.php +++ b/tests/Portugal/CorpusChristiTest.php @@ -59,7 +59,7 @@ public function testHoliday(): void */ public function testNotHoliday(): void { - $year = $this->generateRandomYear(2013, 2015); + $year = static::generateRandomYear(2013, 2015); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -70,7 +70,7 @@ public function testNotHoliday(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); + $year = static::generateRandomYear(self::HOLIDAY_YEAR_RESTORED); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Corpo de Deus']); } @@ -82,11 +82,11 @@ public function testTranslation(): void public function testHolidayType(): void { // Before abolishment - $year = $this->generateRandomYear(1000, self::HOLIDAY_YEAR_ABOLISHED - 1); + $year = static::generateRandomYear(1000, self::HOLIDAY_YEAR_ABOLISHED - 1); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); // After restoration - $year = $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); + $year = static::generateRandomYear(self::HOLIDAY_YEAR_RESTORED); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Portugal/EasterTest.php b/tests/Portugal/EasterTest.php index 32f24b32e..bfe535fa0 100644 --- a/tests/Portugal/EasterTest.php +++ b/tests/Portugal/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Páscoa'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Portugal/GoodFridayTest.php b/tests/Portugal/GoodFridayTest.php index 02c47c67d..c12b82927 100644 --- a/tests/Portugal/GoodFridayTest.php +++ b/tests/Portugal/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Sexta-feira Santa'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Portugal/ImmaculateConceptionTest.php b/tests/Portugal/ImmaculateConceptionTest.php index 3a1803bd1..abe7cd1f0 100644 --- a/tests/Portugal/ImmaculateConceptionTest.php +++ b/tests/Portugal/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends PortugalBaseTestCase implements HolidayTe /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Dia da Imaculada Conceição'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Portugal/InternationalWorkersDayTest.php b/tests/Portugal/InternationalWorkersDayTest.php index 698c8e8c9..c781afc42 100644 --- a/tests/Portugal/InternationalWorkersDayTest.php +++ b/tests/Portugal/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends PortugalBaseTestCase implements Holida /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Dia do Trabalhador'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Portugal/NewYearsDayTest.php b/tests/Portugal/NewYearsDayTest.php index 4f2345ae7..93216289d 100644 --- a/tests/Portugal/NewYearsDayTest.php +++ b/tests/Portugal/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends PortugalBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Dia de Ano Novo'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Portugal/PortugalDayTest.php b/tests/Portugal/PortugalDayTest.php index 653600637..539659bf4 100644 --- a/tests/Portugal/PortugalDayTest.php +++ b/tests/Portugal/PortugalDayTest.php @@ -49,7 +49,7 @@ class PortugalDayTest extends PortugalBaseTestCase implements HolidayTestCase */ public function testHolidayBeforeAbolishment(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR_BEFORE); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR_BEFORE); $expected = new \DateTime("{$year}-06-10", new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); } @@ -63,7 +63,7 @@ public function testHolidayBeforeAbolishment(): void */ public function testHolidayAfterRestoration(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR_AFTER); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR_AFTER); $expected = new \DateTime("{$year}-06-10", new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); } @@ -77,7 +77,7 @@ public function testHolidayAfterRestoration(): void */ public function testNotHolidayDuringAbolishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR_BEFORE + 1, self::ESTABLISHMENT_YEAR_AFTER - 1); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR_BEFORE + 1, self::ESTABLISHMENT_YEAR_AFTER - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); $this->assertNotHoliday(self::REGION, self::HOLIDAY, self::ESTABLISHMENT_YEAR_BEFORE + 1); @@ -91,10 +91,10 @@ public function testNotHolidayDuringAbolishment(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR_BEFORE); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR_BEFORE); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Dia de Portugal']); - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR_AFTER); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR_AFTER); $this->assertTranslatedHolidayName(self::REGION, self::HOLIDAY, $year, [self::LOCALE => 'Dia de Portugal']); } @@ -105,10 +105,10 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR_BEFORE); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR_BEFORE); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR_AFTER); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR_AFTER); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Portugal/PortugalTest.php b/tests/Portugal/PortugalTest.php index e6e12ccf4..b241dc92d 100644 --- a/tests/Portugal/PortugalTest.php +++ b/tests/Portugal/PortugalTest.php @@ -37,7 +37,7 @@ class PortugalTest extends PortugalBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1974); + $this->year = static::generateRandomYear(1974); } /** diff --git a/tests/Portugal/PortugueseRepublicDayTest.php b/tests/Portugal/PortugueseRepublicDayTest.php index fc8a17139..3abb4a9c1 100644 --- a/tests/Portugal/PortugueseRepublicDayTest.php +++ b/tests/Portugal/PortugueseRepublicDayTest.php @@ -53,7 +53,7 @@ public function testNotHolidayDuringAbolishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::HOLIDAY_YEAR_SUSPENDED, self::HOLIDAY_YEAR_RESTORED - 1) + static::generateRandomYear(self::HOLIDAY_YEAR_SUSPENDED, self::HOLIDAY_YEAR_RESTORED - 1) ); } @@ -120,8 +120,8 @@ public function testHolidayType(): void */ private function randomEstablishedYear(): \Generator { - yield $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_SUSPENDED - 1); - yield $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); + yield static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_SUSPENDED - 1); + yield static::generateRandomYear(self::HOLIDAY_YEAR_RESTORED); } /** @return \Generator @@ -129,7 +129,7 @@ private function randomEstablishedYear(): \Generator */ private function randomYearsBeforeEstablishment(): \Generator { - yield $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + yield static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); yield self::ESTABLISHMENT_YEAR - 1; } @@ -138,7 +138,7 @@ private function randomYearsBeforeEstablishment(): \Generator */ private function randomYearsOnAfterEstablishment(): \Generator { - yield $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_SUSPENDED - 1); + yield static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_SUSPENDED - 1); yield self::ESTABLISHMENT_YEAR; } @@ -147,7 +147,7 @@ private function randomYearsOnAfterEstablishment(): \Generator */ private function randomYearsOnAfterRestoration(): \Generator { - yield $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); + yield static::generateRandomYear(self::HOLIDAY_YEAR_RESTORED); yield self::HOLIDAY_YEAR_RESTORED; } } diff --git a/tests/Portugal/RestorationOfIndependenceTest.php b/tests/Portugal/RestorationOfIndependenceTest.php index 3eb501bc3..90cf9016a 100644 --- a/tests/Portugal/RestorationOfIndependenceTest.php +++ b/tests/Portugal/RestorationOfIndependenceTest.php @@ -52,7 +52,7 @@ class RestorationOfIndependenceTest extends PortugalBaseTestCase implements Holi */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_ABOLISHED - 1); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_ABOLISHED - 1); $expected = new \DateTime("{$year}-12-01", new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -75,7 +75,7 @@ public function testHolidayOnAfterRestoration(): void $expected = new \DateTime("{$year}-12-01", new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); - $year = $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); + $year = static::generateRandomYear(self::HOLIDAY_YEAR_RESTORED); $expected = new \DateTime("{$year}-12-01", new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -88,7 +88,7 @@ public function testHolidayOnAfterRestoration(): void */ public function testNotHolidayDuringAbolishment(): void { - $year = $this->generateRandomYear(2013, 2015); + $year = static::generateRandomYear(2013, 2015); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -99,7 +99,7 @@ public function testNotHolidayDuringAbolishment(): void */ public function testHolidayBeforeEstablishment(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); $year = 1849; @@ -113,7 +113,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_ABOLISHED - 1); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_ABOLISHED - 1); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, @@ -121,7 +121,7 @@ public function testTranslation(): void [self::LOCALE => 'Restauração da Independência'] ); - $year = $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); + $year = static::generateRandomYear(self::HOLIDAY_YEAR_RESTORED); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, @@ -138,11 +138,11 @@ public function testTranslation(): void public function testHolidayType(): void { // After establishment and before abolishment - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_ABOLISHED - 1); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::HOLIDAY_YEAR_ABOLISHED - 1); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); // After restoration - $this->generateRandomYear(self::HOLIDAY_YEAR_RESTORED); + static::generateRandomYear(self::HOLIDAY_YEAR_RESTORED); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Randomizer.php b/tests/Randomizer.php index f37e2993f..99bc88b6d 100644 --- a/tests/Randomizer.php +++ b/tests/Randomizer.php @@ -37,7 +37,7 @@ trait Randomizer * * @throws \Exception */ - public function generateRandomDates( + public static function generateRandomDates( int $month, int $day, ?string $timezone = null, @@ -65,7 +65,7 @@ public function generateRandomDates( * * @throws \Exception */ - public function generateRandomEasterDates( + public static function generateRandomEasterDates( ?string $timezone = null, ?int $iterations = null, ?int $range = null, @@ -75,7 +75,7 @@ public function generateRandomEasterDates( for ($i = 1; $i <= ($iterations ?? 10); ++$i) { $year = (int) self::dateTimeBetween("-{$range} years", "+{$range} years")->format('Y'); - $date = $this->calculateEaster($year, $timezone ?? 'UTC'); + $date = static::computeEaster($year, $timezone ?? 'UTC'); $data[] = [$year, $date->format('Y-m-d')]; } @@ -94,14 +94,14 @@ public function generateRandomEasterDates( * * @throws \Exception */ - public function generateRandomEasterMondayDates( + public static function generateRandomEasterMondayDates( ?string $timezone = null, ?int $iterations = null, ?int $range = null, ): array { $range ??= 1000; - return $this->generateRandomModifiedEasterDates(static function (\DateTime $date): void { + return static::generateRandomModifiedEasterDates(static function (\DateTime $date): void { $date->add(new \DateInterval('P1D')); }, $timezone ?? 'UTC', $iterations ?? 10, $range); } @@ -118,7 +118,7 @@ public function generateRandomEasterMondayDates( * * @throws \Exception */ - public function generateRandomModifiedEasterDates( + public static function generateRandomModifiedEasterDates( callable $cb, ?string $timezone = null, ?int $iterations = null, @@ -128,7 +128,7 @@ public function generateRandomModifiedEasterDates( $range ??= 1000; for ($i = 1; $i <= ($iterations ?? 10); ++$i) { $year = (int) self::dateTimeBetween("-{$range} years", "+{$range} years")->format('Y'); - $date = $this->calculateEaster($year, $timezone ?? 'UTC'); + $date = static::computeEaster($year, $timezone ?? 'UTC'); $cb($date); @@ -149,14 +149,14 @@ public function generateRandomModifiedEasterDates( * * @throws \Exception */ - public function generateRandomGoodFridayDates( + public static function generateRandomGoodFridayDates( ?string $timezone = null, ?int $iterations = null, ?int $range = null, ): array { $range ??= 1000; - return $this->generateRandomModifiedEasterDates(static function (\DateTime $date): void { + return static::generateRandomModifiedEasterDates(static function (\DateTime $date): void { $date->sub(new \DateInterval('P2D')); }, $timezone ?? 'UTC', $iterations ?? 10, $range); } @@ -172,14 +172,14 @@ public function generateRandomGoodFridayDates( * * @throws \Exception */ - public function generateRandomPentecostDates( + public static function generateRandomPentecostDates( ?string $timezone = null, ?int $iterations = null, ?int $range = null, ): array { $range ??= 1000; - return $this->generateRandomModifiedEasterDates(static function (\DateTime $date): void { + return static::generateRandomModifiedEasterDates(static function (\DateTime $date): void { $date->add(new \DateInterval('P49D')); }, $timezone ?? 'UTC', $iterations ?? 10, $range); } @@ -198,15 +198,15 @@ public function generateRandomPentecostDates( * * @throws \Exception */ - public function generateRandomDatesWithHolidayMovedToMonday( + public static function generateRandomDatesWithHolidayMovedToMonday( int $month, int $day, ?string $timezone = null, ?int $iterations = null, ?int $range = null, ): array { - return $this->generateRandomDatesWithModifier($month, $day, function ($range, \DateTime $date): void { - if ($this->isWeekend($date)) { + return static::generateRandomDatesWithModifier($month, $day, static function ($range, \DateTime $date): void { + if (static::isWeekend($date)) { $date->modify('next monday'); } }, $iterations ?? 10, $range, $timezone ?? 'UTC'); @@ -226,7 +226,7 @@ public function generateRandomDatesWithHolidayMovedToMonday( * * @throws \Exception */ - public function generateRandomDatesWithModifier( + public static function generateRandomDatesWithModifier( int $month, int $day, callable $callback, @@ -237,10 +237,13 @@ public function generateRandomDatesWithModifier( $data = []; for ($i = 1; $i <= $iterations; ++$i) { - $year = $this->generateRandomYear($range); + $year = static::generateRandomYear($range); $date = new \DateTime("{$year}-{$month}-{$day}", new \DateTimeZone($timezone ?? 'UTC')); - $callback($year, $date); + if (false === $callback($year, $date)) { + --$i; + continue; + } $data[] = [$year, $date->format('Y-m-d')]; } @@ -258,11 +261,11 @@ public function generateRandomDatesWithModifier( * * @throws \Exception */ - public function generateRandomYear( + public static function generateRandomYear( ?int $lowerLimit = null, ?int $upperLimit = null, ): int { - return self::numberBetween($lowerLimit ?? 1000, $upperLimit ?? 9999); + return self::numberBetween($lowerLimit ?? 1800, $upperLimit ?? 2200); } /** @@ -273,7 +276,7 @@ public function generateRandomYear( * * @return bool true if $dateTime is a weekend, false otherwise */ - public function isWeekend( + public static function isWeekend( \DateTimeInterface $dateTime, array $weekendDays = [0, 6], ): bool { @@ -336,7 +339,7 @@ public static function dateTimeBetween($startDate = '-30 years', $endDate = 'now ); } - public function randomYearFromArray(array $years): int + public static function randomYearFromArray(array $years): int { if ([] === $years) { throw new \InvalidArgumentException(' years array must not be empty'); @@ -369,7 +372,10 @@ public function randomYearFromArray(array $years): int * @see http://www.gmarts.org/index.php?go=415#EasterMallen * @see http://www.tondering.dk/claus/cal/easter.php */ - protected function calculateEaster(int $year, string $timezone): \DateTimeInterface + /** + * Static Easter calculation used by data providers (avoids conflict with ChristianHolidays::calculateEaster). + */ + protected static function computeEaster(int $year, string $timezone): \DateTimeInterface { if (\extension_loaded('calendar')) { $easter_days = easter_days($year); @@ -424,6 +430,11 @@ protected function calculateEaster(int $year, string $timezone): \DateTimeInterf return $easter; } + protected function calculateEaster(int $year, string $timezone): \DateTimeInterface + { + return static::computeEaster($year, $timezone); + } + /** * @param \DateTime|string|float|int $max * diff --git a/tests/Romania/AssumptionOfMaryTest.php b/tests/Romania/AssumptionOfMaryTest.php index 377c2ed13..1a3746af6 100644 --- a/tests/Romania/AssumptionOfMaryTest.php +++ b/tests/Romania/AssumptionOfMaryTest.php @@ -42,7 +42,7 @@ class AssumptionOfMaryTest extends RomaniaBaseTestCase implements HolidayTestCas */ public function testAssumptionOfMaryDayOnAfter2008(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testAssumptionOfMaryDayBefore2008(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Adormirea Maicii Domnului'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Romania/ChildrensDayTest.php b/tests/Romania/ChildrensDayTest.php index 0cc9dec51..ff205c4fc 100644 --- a/tests/Romania/ChildrensDayTest.php +++ b/tests/Romania/ChildrensDayTest.php @@ -42,7 +42,7 @@ class ChildrensDayTest extends RomaniaBaseTestCase implements HolidayTestCase */ public function testChildrensDayOnAfter1950(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testChildrensDayBefore1950(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Ziua Copilului'] ); } @@ -90,9 +90,9 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 2016), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 2016), Holiday::TYPE_OBSERVANCE ); - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(2017), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(2017), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Romania/ChristmasDayTest.php b/tests/Romania/ChristmasDayTest.php index 5d1a6e943..3a21a10de 100644 --- a/tests/Romania/ChristmasDayTest.php +++ b/tests/Romania/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends RomaniaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Crăciunul'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Romania/ConstantinBrancusiDayTest.php b/tests/Romania/ConstantinBrancusiDayTest.php index 7800ecc2e..74bc3d38a 100644 --- a/tests/Romania/ConstantinBrancusiDayTest.php +++ b/tests/Romania/ConstantinBrancusiDayTest.php @@ -42,7 +42,7 @@ class ConstantinBrancusiDayTest extends RomaniaBaseTestCase implements HolidayTe */ public function testConstantinBrancusiDayOnAfter2016(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testConstantinBrancusiDayBefore2016(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Ziua Constantin Brâncuși'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OBSERVANCE ); } diff --git a/tests/Romania/DayAfterNewYearsDayTest.php b/tests/Romania/DayAfterNewYearsDayTest.php index 7b7b58499..f0df9429c 100644 --- a/tests/Romania/DayAfterNewYearsDayTest.php +++ b/tests/Romania/DayAfterNewYearsDayTest.php @@ -33,11 +33,10 @@ class DayAfterNewYearsDayTest extends RomaniaBaseTestCase implements HolidayTest /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 2, self::TIMEZONE); + return static::generateRandomDates(1, 2, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'A doua zi după Anul Nou'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Romania/EasterMondayTest.php b/tests/Romania/EasterMondayTest.php index bb8526af6..637fbe337 100644 --- a/tests/Romania/EasterMondayTest.php +++ b/tests/Romania/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'A doua zi de Paște'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Romania/EasterTest.php b/tests/Romania/EasterTest.php index 0e015e818..2a695b766 100644 --- a/tests/Romania/EasterTest.php +++ b/tests/Romania/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Paștele'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Romania/EpiphanyTest.php b/tests/Romania/EpiphanyTest.php index 20310f034..e277010f5 100644 --- a/tests/Romania/EpiphanyTest.php +++ b/tests/Romania/EpiphanyTest.php @@ -42,7 +42,7 @@ class EpiphanyTest extends RomaniaBaseTestCase implements HolidayTestCase */ public function testEpiphanyAfter2024(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testEpiphanyBefore2024(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Bobotează'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Romania/InternationalWorkersDayTest.php b/tests/Romania/InternationalWorkersDayTest.php index 0e70e5490..f6b7ab120 100644 --- a/tests/Romania/InternationalWorkersDayTest.php +++ b/tests/Romania/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends RomaniaBaseTestCase implements Holiday /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ziua internațională a muncii'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Romania/NationalDayTest.php b/tests/Romania/NationalDayTest.php index 348ccc5ee..7c0cafb2f 100644 --- a/tests/Romania/NationalDayTest.php +++ b/tests/Romania/NationalDayTest.php @@ -42,7 +42,7 @@ class NationalDayTest extends RomaniaBaseTestCase implements HolidayTestCase */ public function testNationalDayOnAfter1990(): void { - $year = $this->generateRandomYear(1990); + $year = static::generateRandomYear(1990); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -58,7 +58,7 @@ public function testNationalDayOnAfter1990(): void */ public function testNationalDayBetween19481989(): void { - $year = $this->generateRandomYear(1948, 1989); + $year = static::generateRandomYear(1948, 1989); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -74,7 +74,7 @@ public function testNationalDayBetween19481989(): void */ public function testNationalDayBetween18661947(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1947); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1947); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -93,7 +93,7 @@ public function testNationalDayBefore1865(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -107,7 +107,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Ziua Națională'] ); } @@ -122,7 +122,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Romania/NewYearsDayTest.php b/tests/Romania/NewYearsDayTest.php index bd9bab8ce..9e3aa738d 100644 --- a/tests/Romania/NewYearsDayTest.php +++ b/tests/Romania/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends RomaniaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Anul Nou'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Romania/PentecostMondayTest.php b/tests/Romania/PentecostMondayTest.php index cce50e027..1ec80bd7d 100644 --- a/tests/Romania/PentecostMondayTest.php +++ b/tests/Romania/PentecostMondayTest.php @@ -61,7 +61,7 @@ public function testPentecostMondayBefore2008(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'A doua zi de Rusalii'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Romania/PentecostTest.php b/tests/Romania/PentecostTest.php index 340cc08a7..a97695bb1 100644 --- a/tests/Romania/PentecostTest.php +++ b/tests/Romania/PentecostTest.php @@ -61,7 +61,7 @@ public function testPentecostDayBefore2008(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Rusaliile'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Romania/RomaniaTest.php b/tests/Romania/RomaniaTest.php index 948823b04..757248510 100644 --- a/tests/Romania/RomaniaTest.php +++ b/tests/Romania/RomaniaTest.php @@ -37,7 +37,7 @@ class RomaniaTest extends RomaniaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(2015, 2028); + $this->year = static::generateRandomYear(2015, 2028); } /** diff --git a/tests/Romania/SecondChristmasDayTest.php b/tests/Romania/SecondChristmasDayTest.php index c50b32a90..4f5ee3f51 100644 --- a/tests/Romania/SecondChristmasDayTest.php +++ b/tests/Romania/SecondChristmasDayTest.php @@ -33,11 +33,10 @@ class SecondChristmasDayTest extends RomaniaBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'A doua zi de Crăciun'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Romania/StAndrewsDayTest.php b/tests/Romania/StAndrewsDayTest.php index ced484236..cd699afb6 100644 --- a/tests/Romania/StAndrewsDayTest.php +++ b/tests/Romania/StAndrewsDayTest.php @@ -42,7 +42,7 @@ class StAndrewsDayTest extends RomaniaBaseTestCase implements HolidayTestCase */ public function testStAndrewDayOnAfter2012(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testStAndrewDayBefore2012(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Sfântul Andrei'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Romania/StJohnsDayTest.php b/tests/Romania/StJohnsDayTest.php index 2429611db..dbe65826c 100644 --- a/tests/Romania/StJohnsDayTest.php +++ b/tests/Romania/StJohnsDayTest.php @@ -42,7 +42,7 @@ class StJohnsDayTest extends RomaniaBaseTestCase implements HolidayTestCase */ public function testStJohnsAfter2024(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testStJohnsDayBefore2024(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Sfântul Ioan Botezătorul'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Romania/UnitedPrincipalitiesDayTest.php b/tests/Romania/UnitedPrincipalitiesDayTest.php index eafb44165..b2ecc7eda 100644 --- a/tests/Romania/UnitedPrincipalitiesDayTest.php +++ b/tests/Romania/UnitedPrincipalitiesDayTest.php @@ -42,7 +42,7 @@ class UnitedPrincipalitiesDayTest extends RomaniaBaseTestCase implements Holiday */ public function testUnitedPrincipalitiesDayOnAfter2015(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testUnitedPrincipalitiesDayBefore2015(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Unirea Principatelor Române / Mica Unire'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Russia/DefenceOfTheFatherlandDayTest.php b/tests/Russia/DefenceOfTheFatherlandDayTest.php index 0481da010..8091cea0f 100644 --- a/tests/Russia/DefenceOfTheFatherlandDayTest.php +++ b/tests/Russia/DefenceOfTheFatherlandDayTest.php @@ -43,7 +43,7 @@ public function testHolidayBefore(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR - 1) + static::generateRandomYear(1000, Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR - 1) ); } @@ -54,7 +54,7 @@ public function testHolidayBefore(): void */ public function testHolidayAfter(): void { - $year = $this->generateRandomYear(Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR); + $year = static::generateRandomYear(Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR); $this->assertHoliday( self::REGION, @@ -72,13 +72,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR), + static::generateRandomYear(Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR), [self::LOCALE => 'День защитника Отечества'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR), + static::generateRandomYear(Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR), ['en' => 'Defence of the Fatherland Day'] ); } @@ -91,7 +91,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR), + static::generateRandomYear(Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Russia/InternationalWomensDayTest.php b/tests/Russia/InternationalWomensDayTest.php index 537aac2de..a1e4773f3 100644 --- a/tests/Russia/InternationalWomensDayTest.php +++ b/tests/Russia/InternationalWomensDayTest.php @@ -37,14 +37,12 @@ class InternationalWomensDayTest extends RussiaBaseTestCase implements HolidayTe * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(3, 8, self::TIMEZONE); + return static::generateRandomDates(3, 8, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Международный женский день'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Russia/NewYearHolidaysDay2Test.php b/tests/Russia/NewYearHolidaysDay2Test.php index f03ea5e7d..4d07d008d 100644 --- a/tests/Russia/NewYearHolidaysDay2Test.php +++ b/tests/Russia/NewYearHolidaysDay2Test.php @@ -37,14 +37,12 @@ class NewYearHolidaysDay2Test extends RussiaBaseTestCase implements HolidayTestC * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 2, self::TIMEZONE); + return static::generateRandomDates(1, 2, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Новогодние каникулы'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Russia/NewYearHolidaysDay3Test.php b/tests/Russia/NewYearHolidaysDay3Test.php index 5111c0b27..e50bcb793 100644 --- a/tests/Russia/NewYearHolidaysDay3Test.php +++ b/tests/Russia/NewYearHolidaysDay3Test.php @@ -37,14 +37,12 @@ class NewYearHolidaysDay3Test extends RussiaBaseTestCase implements HolidayTestC * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 3, self::TIMEZONE); + return static::generateRandomDates(1, 3, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Новогодние каникулы'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Russia/NewYearHolidaysDay4Test.php b/tests/Russia/NewYearHolidaysDay4Test.php index 3833ebd18..6773bc290 100644 --- a/tests/Russia/NewYearHolidaysDay4Test.php +++ b/tests/Russia/NewYearHolidaysDay4Test.php @@ -37,14 +37,12 @@ class NewYearHolidaysDay4Test extends RussiaBaseTestCase implements HolidayTestC * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 4, self::TIMEZONE); + return static::generateRandomDates(1, 4, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Новогодние каникулы'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Russia/NewYearHolidaysDay5Test.php b/tests/Russia/NewYearHolidaysDay5Test.php index 029874b55..c070f7cbd 100644 --- a/tests/Russia/NewYearHolidaysDay5Test.php +++ b/tests/Russia/NewYearHolidaysDay5Test.php @@ -37,14 +37,12 @@ class NewYearHolidaysDay5Test extends RussiaBaseTestCase implements HolidayTestC * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 5, self::TIMEZONE); + return static::generateRandomDates(1, 5, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Новогодние каникулы'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Russia/NewYearHolidaysDay6Test.php b/tests/Russia/NewYearHolidaysDay6Test.php index ad3d489e5..731d84223 100644 --- a/tests/Russia/NewYearHolidaysDay6Test.php +++ b/tests/Russia/NewYearHolidaysDay6Test.php @@ -37,14 +37,12 @@ class NewYearHolidaysDay6Test extends RussiaBaseTestCase implements HolidayTestC * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Новогодние каникулы'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Russia/NewYearHolidaysDay8Test.php b/tests/Russia/NewYearHolidaysDay8Test.php index 20c365766..b37dd59ad 100644 --- a/tests/Russia/NewYearHolidaysDay8Test.php +++ b/tests/Russia/NewYearHolidaysDay8Test.php @@ -37,14 +37,12 @@ class NewYearHolidaysDay8Test extends RussiaBaseTestCase implements HolidayTestC * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 8, self::TIMEZONE); + return static::generateRandomDates(1, 8, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Новогодние каникулы'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Russia/NewYearsDayTest.php b/tests/Russia/NewYearsDayTest.php index 548f9738e..f4d6221c7 100644 --- a/tests/Russia/NewYearsDayTest.php +++ b/tests/Russia/NewYearsDayTest.php @@ -37,14 +37,12 @@ class NewYearsDayTest extends RussiaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Новый год'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Russia/OrthodoxChristmasDayTest.php b/tests/Russia/OrthodoxChristmasDayTest.php index 59ebfa9e3..2cff4d971 100644 --- a/tests/Russia/OrthodoxChristmasDayTest.php +++ b/tests/Russia/OrthodoxChristmasDayTest.php @@ -37,14 +37,12 @@ class OrthodoxChristmasDayTest extends RussiaBaseTestCase implements HolidayTest * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(1, 7, self::TIMEZONE); + return static::generateRandomDates(1, 7, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Рождество'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Russia/RussiaDayTest.php b/tests/Russia/RussiaDayTest.php index 82d74e86f..1c79f10c4 100644 --- a/tests/Russia/RussiaDayTest.php +++ b/tests/Russia/RussiaDayTest.php @@ -43,7 +43,7 @@ public function testHolidayBefore(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Russia::RUSSIA_DAY_START_YEAR - 1) + static::generateRandomYear(1000, Russia::RUSSIA_DAY_START_YEAR - 1) ); } @@ -54,7 +54,7 @@ public function testHolidayBefore(): void */ public function testHolidayAfter(): void { - $year = $this->generateRandomYear(Russia::RUSSIA_DAY_START_YEAR); + $year = static::generateRandomYear(Russia::RUSSIA_DAY_START_YEAR); $this->assertHoliday( self::REGION, @@ -72,13 +72,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Russia::RUSSIA_DAY_START_YEAR), + static::generateRandomYear(Russia::RUSSIA_DAY_START_YEAR), [self::LOCALE => 'День России'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Russia::RUSSIA_DAY_START_YEAR), + static::generateRandomYear(Russia::RUSSIA_DAY_START_YEAR), ['en' => 'Russia Day'] ); } @@ -91,7 +91,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Russia::RUSSIA_DAY_START_YEAR), + static::generateRandomYear(Russia::RUSSIA_DAY_START_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Russia/RussiaTest.php b/tests/Russia/RussiaTest.php index eab2caf32..65b29568b 100644 --- a/tests/Russia/RussiaTest.php +++ b/tests/Russia/RussiaTest.php @@ -49,7 +49,7 @@ public function testOfficialHolidays(): void 'victoryDay', ]; - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); if ($year >= Russia::DEFENCE_OF_THE_FATHERLAND_START_YEAR) { $holidays[] = 'defenceOfTheFatherlandDay'; @@ -73,7 +73,7 @@ public function testOfficialHolidays(): void */ public function testObservedHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } /** @@ -83,7 +83,7 @@ public function testObservedHolidays(): void */ public function testSeasonalHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_SEASON); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_SEASON); } /** @@ -93,7 +93,7 @@ public function testSeasonalHolidays(): void */ public function testBankHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_BANK); } /** @@ -103,7 +103,7 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertDefinedHolidays([], self::REGION, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** diff --git a/tests/Russia/SpringAndLabourDayTest.php b/tests/Russia/SpringAndLabourDayTest.php index e78082fe9..cd350c3f9 100644 --- a/tests/Russia/SpringAndLabourDayTest.php +++ b/tests/Russia/SpringAndLabourDayTest.php @@ -37,14 +37,12 @@ class SpringAndLabourDayTest extends RussiaBaseTestCase implements HolidayTestCa * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Праздник Весны и Труда'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Russia/UnityDayTest.php b/tests/Russia/UnityDayTest.php index d84b2c86d..4c6c35492 100644 --- a/tests/Russia/UnityDayTest.php +++ b/tests/Russia/UnityDayTest.php @@ -43,7 +43,7 @@ public function testHolidayBefore(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, Russia::UNITY_DAY_START_YEAR - 1) + static::generateRandomYear(1000, Russia::UNITY_DAY_START_YEAR - 1) ); } @@ -54,7 +54,7 @@ public function testHolidayBefore(): void */ public function testHolidayAfter(): void { - $year = $this->generateRandomYear(Russia::UNITY_DAY_START_YEAR); + $year = static::generateRandomYear(Russia::UNITY_DAY_START_YEAR); $this->assertHoliday( self::REGION, @@ -72,13 +72,13 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Russia::UNITY_DAY_START_YEAR), + static::generateRandomYear(Russia::UNITY_DAY_START_YEAR), [self::LOCALE => 'День народного единства'] ); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Russia::UNITY_DAY_START_YEAR), + static::generateRandomYear(Russia::UNITY_DAY_START_YEAR), ['en' => 'Unity Day'] ); } @@ -91,7 +91,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Russia::UNITY_DAY_START_YEAR), + static::generateRandomYear(Russia::UNITY_DAY_START_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Russia/VictoryDayTest.php b/tests/Russia/VictoryDayTest.php index ec638158a..8616c4688 100644 --- a/tests/Russia/VictoryDayTest.php +++ b/tests/Russia/VictoryDayTest.php @@ -37,14 +37,12 @@ class VictoryDayTest extends RussiaBaseTestCase implements HolidayTestCase * * @throws \Exception */ - public function holidayDataProvider(): array + public static function holidayDataProvider(): array { - return $this->generateRandomDates(5, 9, self::TIMEZONE); + return static::generateRandomDates(5, 9, self::TIMEZONE); } - /** - * @dataProvider holidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('holidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -58,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'День Победы'] ); } @@ -68,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/SanMarino/AllSaintsDayTest.php b/tests/SanMarino/AllSaintsDayTest.php new file mode 100644 index 000000000..b51fff523 --- /dev/null +++ b/tests/SanMarino/AllSaintsDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for All Saints' Day in San Marino. + */ +class AllSaintsDayTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'allSaintsDay'; + + /** + * Tests All Saints' Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(11, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of All Saints' Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Festa di Tutti i Santi'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/AnniversaryOfArengoTest.php b/tests/SanMarino/AnniversaryOfArengoTest.php new file mode 100644 index 000000000..d7d213039 --- /dev/null +++ b/tests/SanMarino/AnniversaryOfArengoTest.php @@ -0,0 +1,98 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\Provider\SanMarino; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for the Anniversary of the Arengo in San Marino. + * + * Celebrated on 25 March, this holiday commemorates the reconvening of the Arengo (popular assembly) + * in 1906, which granted democratic rights to San Marino's citizens. + * + * @see https://en.wikipedia.org/wiki/Arengo_(San_Marino) + */ +class AnniversaryOfArengoTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'anniversaryOfArengo'; + + /** + * Tests the Anniversary of the Arengo on or after 1906. + * + * @throws \Exception + */ + public function testAnniversaryOfArengoOnAfter1906(): void + { + $year = static::generateRandomYear(SanMarino::ARENGO_YEAR); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-3-25", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests the Anniversary of the Arengo before 1906. + * + * @throws \Exception + */ + public function testAnniversaryOfArengoBefore1906(): void + { + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(1000, SanMarino::ARENGO_YEAR - 1) + ); + } + + /** + * Tests translated name of the Anniversary of the Arengo. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(SanMarino::ARENGO_YEAR), + [self::LOCALE => "Anniversario dell\u{2019}Arengo"] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(SanMarino::ARENGO_YEAR), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/SanMarino/AssumptionOfMaryTest.php b/tests/SanMarino/AssumptionOfMaryTest.php new file mode 100644 index 000000000..9666bf4c2 --- /dev/null +++ b/tests/SanMarino/AssumptionOfMaryTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for the Assumption of Mary in San Marino. + */ +class AssumptionOfMaryTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'assumptionOfMary'; + + /** + * Tests the Assumption of Mary. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(8, 15, self::TIMEZONE); + } + + /** + * Tests the translated name of the Assumption of Mary. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Assunzione di Maria Vergine'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/ChristmasDayTest.php b/tests/SanMarino/ChristmasDayTest.php new file mode 100644 index 000000000..c9b6f8466 --- /dev/null +++ b/tests/SanMarino/ChristmasDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Christmas Day in San Marino. + */ +class ChristmasDayTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'christmasDay'; + + /** + * Tests Christmas Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(12, 25, self::TIMEZONE); + } + + /** + * Tests the translated name of Christmas Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Natale'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/CommemorationOfTheFallenTest.php b/tests/SanMarino/CommemorationOfTheFallenTest.php new file mode 100644 index 000000000..fe8cc0ee6 --- /dev/null +++ b/tests/SanMarino/CommemorationOfTheFallenTest.php @@ -0,0 +1,86 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for the Commemoration of the Fallen in San Marino. + * + * Observed on 2 November, this official public holiday honours all deceased persons, coinciding + * with All Souls' Day in the Catholic tradition. + * + * @see https://en.wikipedia.org/wiki/All_Souls%27_Day + */ +class CommemorationOfTheFallenTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'commemorationOfTheFallen'; + + /** + * Tests the Commemoration of the Fallen. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(11, 2, self::TIMEZONE); + } + + /** + * Tests the translated name of the Commemoration of the Fallen. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Commemorazione dei Defunti'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/CorpusChristiTest.php b/tests/SanMarino/CorpusChristiTest.php new file mode 100644 index 000000000..12a18e3a5 --- /dev/null +++ b/tests/SanMarino/CorpusChristiTest.php @@ -0,0 +1,95 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Corpus Christi in San Marino. + * + * Corpus Christi (Italian: Corpus Domini) is celebrated on the Thursday 60 days after Easter Sunday. + * + * @see https://en.wikipedia.org/wiki/Corpus_Christi_(feast) + */ +class CorpusChristiTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'corpusChristi'; + + /** + * Tests Corpus Christi. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + * + * @throws \Exception + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $this->assertHoliday(self::REGION, self::HOLIDAY, $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 static function HolidayDataProvider(): array + { + return [ + [2020, new \DateTime('2020-6-11', new \DateTimeZone(self::TIMEZONE))], + [2021, new \DateTime('2021-6-3', new \DateTimeZone(self::TIMEZONE))], + [2022, new \DateTime('2022-6-16', new \DateTimeZone(self::TIMEZONE))], + [2023, new \DateTime('2023-6-8', new \DateTimeZone(self::TIMEZONE))], + [2024, new \DateTime('2024-5-30', new \DateTimeZone(self::TIMEZONE))], + [2025, new \DateTime('2025-6-19', new \DateTimeZone(self::TIMEZONE))], + [2026, new \DateTime('2026-6-4', new \DateTimeZone(self::TIMEZONE))], + ]; + } + + /** + * Tests the translated name of Corpus Christi. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Corpus Domini'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/EasterMondayTest.php b/tests/SanMarino/EasterMondayTest.php new file mode 100644 index 000000000..861aac092 --- /dev/null +++ b/tests/SanMarino/EasterMondayTest.php @@ -0,0 +1,73 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Easter Monday in San Marino. + */ +class EasterMondayTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'easterMonday'; + + /** + * Tests Easter Monday. + * + * @throws \Exception + */ + public function testHoliday(): void + { + $year = 2024; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-4-1", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests translated name of Easter Monday. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => "Lunedì dell\u{2019}Angelo"] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/EasterTest.php b/tests/SanMarino/EasterTest.php new file mode 100644 index 000000000..8ef97d6c9 --- /dev/null +++ b/tests/SanMarino/EasterTest.php @@ -0,0 +1,73 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Easter in San Marino. + */ +class EasterTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'easter'; + + /** + * Tests Easter. + * + * @throws \Exception + */ + public function testEaster(): void + { + $year = 2024; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-3-31", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests translated name of Easter. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Pasqua'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/EpiphanyTest.php b/tests/SanMarino/EpiphanyTest.php new file mode 100644 index 000000000..17d3599aa --- /dev/null +++ b/tests/SanMarino/EpiphanyTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Epiphany in San Marino. + */ +class EpiphanyTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'epiphany'; + + /** + * Tests Epiphany. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(1, 6, self::TIMEZONE); + } + + /** + * Tests the translated name of Epiphany. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Epifania'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/FallOfFascismTest.php b/tests/SanMarino/FallOfFascismTest.php new file mode 100644 index 000000000..287c2da63 --- /dev/null +++ b/tests/SanMarino/FallOfFascismTest.php @@ -0,0 +1,98 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\Provider\SanMarino; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for the Fall of Fascism in San Marino. + * + * Observed on 28 July, this holiday commemorates the coup d'état of 28 July 1943 that overthrew + * San Marino's Fascist government. It has been observed since 1944. + * + * @see https://en.wikipedia.org/wiki/San_Marino_in_World_War_II + */ +class FallOfFascismTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'fallOfFascism'; + + /** + * Tests the Fall of Fascism on or after 1944. + * + * @throws \Exception + */ + public function testFallOfFascismOnAfter1944(): void + { + $year = static::generateRandomYear(SanMarino::FALL_OF_FASCISM_YEAR); + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-7-28", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** + * Tests the Fall of Fascism before 1944. + * + * @throws \Exception + */ + public function testFallOfFascismBefore1944(): void + { + $this->assertNotHoliday( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(1000, SanMarino::FALL_OF_FASCISM_YEAR - 1) + ); + } + + /** + * Tests translated name of the Fall of Fascism. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(SanMarino::FALL_OF_FASCISM_YEAR), + [self::LOCALE => 'Caduta del Fascismo'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(SanMarino::FALL_OF_FASCISM_YEAR), + Holiday::TYPE_OFFICIAL + ); + } +} diff --git a/tests/SanMarino/FeastOfSaintAgathaTest.php b/tests/SanMarino/FeastOfSaintAgathaTest.php new file mode 100644 index 000000000..85d4686d2 --- /dev/null +++ b/tests/SanMarino/FeastOfSaintAgathaTest.php @@ -0,0 +1,86 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for the Feast of Saint Agatha in San Marino. + * + * The Feast of Saint Agatha is celebrated on 5 February. Saint Agatha is the patron saint of San Marino. + * The day also commemorates the liberation from the occupation by Cardinal Giulio Alberoni on 5 February 1740. + * + * @see https://en.wikipedia.org/wiki/Saint_Agatha + */ +class FeastOfSaintAgathaTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'feastOfSaintAgatha'; + + /** + * Tests the Feast of Saint Agatha. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(2, 5, self::TIMEZONE); + } + + /** + * Tests the translated name of the Feast of Saint Agatha. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => "Festa di Sant\u{2019}Agata"] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/FoundationDayTest.php b/tests/SanMarino/FoundationDayTest.php new file mode 100644 index 000000000..523bd4c6c --- /dev/null +++ b/tests/SanMarino/FoundationDayTest.php @@ -0,0 +1,86 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for Foundation Day in San Marino. + * + * Foundation Day (Italian: Anniversario della Fondazione della Repubblica), observed on 3 September, + * commemorates the traditional founding of San Marino on 3 September 301 AD by Saint Marinus of Rab. + * + * @see https://en.wikipedia.org/wiki/San_Marino + */ +class FoundationDayTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'foundationDay'; + + /** + * Tests Foundation Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(9, 3, self::TIMEZONE); + } + + /** + * Tests the translated name of Foundation Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Anniversario della Fondazione della Repubblica'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/ImmaculateConceptionTest.php b/tests/SanMarino/ImmaculateConceptionTest.php new file mode 100644 index 000000000..ca9eb39b0 --- /dev/null +++ b/tests/SanMarino/ImmaculateConceptionTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for the Immaculate Conception in San Marino. + */ +class ImmaculateConceptionTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'immaculateConception'; + + /** + * Tests the Immaculate Conception. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(12, 8, self::TIMEZONE); + } + + /** + * Tests the translated name of the Immaculate Conception. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Immacolata Concezione'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/InternationalWorkersDayTest.php b/tests/SanMarino/InternationalWorkersDayTest.php new file mode 100644 index 000000000..1dc50a7e5 --- /dev/null +++ b/tests/SanMarino/InternationalWorkersDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for International Workers' Day in San Marino. + */ +class InternationalWorkersDayTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'internationalWorkersDay'; + + /** + * Tests International Workers' Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(5, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of International Workers' Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Festa del Lavoro'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/InvestitureCaptainsRegentAprilTest.php b/tests/SanMarino/InvestitureCaptainsRegentAprilTest.php new file mode 100644 index 000000000..c5a287f42 --- /dev/null +++ b/tests/SanMarino/InvestitureCaptainsRegentAprilTest.php @@ -0,0 +1,86 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for the Investiture of the Captains Regent (April) in San Marino. + * + * Observed on 1 April, this holiday marks the formal investiture of the two Captains Regent, + * the heads of state of San Marino, elected every six months. + * + * @see https://en.wikipedia.org/wiki/Captain_Regent + */ +class InvestitureCaptainsRegentAprilTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'investitureCaptainsRegentApril'; + + /** + * Tests the Investiture of the Captains Regent (April). + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(4, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of the Investiture of the Captains Regent (April). + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Investitura dei Capitani Reggenti'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/InvestitureCaptainsRegentOctoberTest.php b/tests/SanMarino/InvestitureCaptainsRegentOctoberTest.php new file mode 100644 index 000000000..25459cf1a --- /dev/null +++ b/tests/SanMarino/InvestitureCaptainsRegentOctoberTest.php @@ -0,0 +1,86 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for the Investiture of the Captains Regent (October) in San Marino. + * + * Observed on 1 October, this holiday marks the formal investiture of the two Captains Regent, + * the heads of state of San Marino, elected every six months. + * + * @see https://en.wikipedia.org/wiki/Captain_Regent + */ +class InvestitureCaptainsRegentOctoberTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'investitureCaptainsRegentOctober'; + + /** + * Tests the Investiture of the Captains Regent (October). + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(10, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of the Investiture of the Captains Regent (October). + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Investitura dei Capitani Reggenti'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/NewYearsDayTest.php b/tests/SanMarino/NewYearsDayTest.php new file mode 100644 index 000000000..805d4870d --- /dev/null +++ b/tests/SanMarino/NewYearsDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for New Year's Day in San Marino. + */ +class NewYearsDayTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'newYearsDay'; + + /** + * Tests New Year's Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(1, 1, self::TIMEZONE); + } + + /** + * Tests the translated name of New Year's Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Capodanno'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/SanMarino/SanMarinoBaseTestCase.php b/tests/SanMarino/SanMarinoBaseTestCase.php new file mode 100644 index 000000000..3c40bd9f2 --- /dev/null +++ b/tests/SanMarino/SanMarinoBaseTestCase.php @@ -0,0 +1,38 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use PHPUnit\Framework\TestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for test cases of the San Marino holiday provider. + */ +abstract class SanMarinoBaseTestCase extends TestCase +{ + use YasumiBase; + + /** Name of the region (e.g. country / state) to be tested. */ + public const REGION = 'SanMarino'; + + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'Europe/San_Marino'; + + /** Locale that is considered common for this provider. */ + public const LOCALE = 'it_SM'; +} diff --git a/tests/SanMarino/SanMarinoTest.php b/tests/SanMarino/SanMarinoTest.php new file mode 100644 index 000000000..39c647864 --- /dev/null +++ b/tests/SanMarino/SanMarinoTest.php @@ -0,0 +1,111 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\Provider\SanMarino; +use Yasumi\tests\ProviderTestCase; + +/** + * Class for testing holidays in San Marino. + */ +class SanMarinoTest extends SanMarinoBaseTestCase implements ProviderTestCase +{ + /** + * @var int year random year number used for all tests in this Test Case + */ + protected int $year; + + /** + * Initial setup of this Test Case. + * + * @throws \Exception + */ + protected function setUp(): void + { + $this->year = static::generateRandomYear(SanMarino::FALL_OF_FASCISM_YEAR); + } + + /** + * Tests if all official holidays in San Marino are defined by the provider class. + */ + public function testOfficialHolidays(): void + { + $this->assertDefinedHolidays([ + 'newYearsDay', + 'epiphany', + 'feastOfSaintAgatha', + 'anniversaryOfArengo', + 'easter', + 'easterMonday', + 'investitureCaptainsRegentApril', + 'internationalWorkersDay', + 'corpusChristi', + 'fallOfFascism', + 'assumptionOfMary', + 'foundationDay', + 'investitureCaptainsRegentOctober', + 'allSaintsDay', + 'commemorationOfTheFallen', + 'immaculateConception', + 'christmasDay', + 'stStephensDay', + ], self::REGION, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Tests if all observed holidays in San Marino are defined by the provider class. + */ + public function testObservedHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); + } + + /** + * Tests if all seasonal holidays in San Marino are defined by the provider class. + */ + public function testSeasonalHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); + } + + /** + * Tests if all bank holidays in San Marino are defined by the provider class. + */ + public function testBankHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_BANK); + } + + /** + * Tests if all other holidays in San Marino are defined by the provider class. + */ + public function testOtherHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + } + + /** + * @throws \ReflectionException + * @throws \Exception + */ + public function testSources(): void + { + $this->assertSources(self::REGION, 2); + } +} diff --git a/tests/SanMarino/StStephensDayTest.php b/tests/SanMarino/StStephensDayTest.php new file mode 100644 index 000000000..94e6960ce --- /dev/null +++ b/tests/SanMarino/StStephensDayTest.php @@ -0,0 +1,81 @@ + + */ + +namespace Yasumi\tests\SanMarino; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class containing tests for St. Stephen's Day in San Marino. + */ +class StStephensDayTest extends SanMarinoBaseTestCase implements HolidayTestCase +{ + /** + * The name of the holiday. + */ + public const HOLIDAY = 'stStephensDay'; + + /** + * Tests St. Stephen's Day. + * + * @param int $year the year for which the holiday defined in this test needs to be tested + * @param \DateTime $expected the expected date + */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] + public function testHoliday(int $year, \DateTimeInterface $expected): void + { + $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 static function HolidayDataProvider(): array + { + return static::generateRandomDates(12, 26, self::TIMEZONE); + } + + /** + * Tests the translated name of St. Stephen's Day. + * + * @throws \Exception + */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Santo Stefano'] + ); + } + + /** + * Tests type of the holiday defined in this test. + * + * @throws \Exception + */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Slovakia/AllSaintsDayTest.php b/tests/Slovakia/AllSaintsDayTest.php index a29ddbff8..f399e312d 100644 --- a/tests/Slovakia/AllSaintsDayTest.php +++ b/tests/Slovakia/AllSaintsDayTest.php @@ -35,11 +35,10 @@ class AllSaintsDayTest extends SlovakiaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,9 +51,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -67,7 +66,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Sviatok Všetkých svätých'] ); } @@ -79,6 +78,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/Slovakia/ChristmasDayTest.php b/tests/Slovakia/ChristmasDayTest.php index 87278f63d..098e9eaee 100644 --- a/tests/Slovakia/ChristmasDayTest.php +++ b/tests/Slovakia/ChristmasDayTest.php @@ -35,11 +35,10 @@ class ChristmasDayTest extends SlovakiaBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,9 +51,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -67,7 +66,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Prvý sviatok vianočný'] ); } @@ -79,6 +78,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/Slovakia/ChristmasEveTest.php b/tests/Slovakia/ChristmasEveTest.php index 694dcc6b5..ff577766c 100644 --- a/tests/Slovakia/ChristmasEveTest.php +++ b/tests/Slovakia/ChristmasEveTest.php @@ -35,11 +35,10 @@ class ChristmasEveTest extends SlovakiaBaseTestCase implements HolidayTestCase /** * Tests Christmas Eve. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testChristmasEve(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,9 +51,9 @@ public function testChristmasEve(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 24, self::TIMEZONE); + return static::generateRandomDates(12, 24, self::TIMEZONE); } /** @@ -67,7 +66,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Štedrý deň'] ); } @@ -79,6 +78,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/Slovakia/DeclarationOfTheSlovakNationTest.php b/tests/Slovakia/DeclarationOfTheSlovakNationTest.php index 456ca2369..f3c5b18bb 100644 --- a/tests/Slovakia/DeclarationOfTheSlovakNationTest.php +++ b/tests/Slovakia/DeclarationOfTheSlovakNationTest.php @@ -35,11 +35,10 @@ class DeclarationOfTheSlovakNationTest extends SlovakiaBaseTestCase implements H /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { if (2018 === $year) { @@ -56,9 +55,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(10, 30, self::TIMEZONE); + return static::generateRandomDates(10, 30, self::TIMEZONE); } /** diff --git a/tests/Slovakia/EasterMondayTest.php b/tests/Slovakia/EasterMondayTest.php index d19edf7ea..1e4775c7b 100644 --- a/tests/Slovakia/EasterMondayTest.php +++ b/tests/Slovakia/EasterMondayTest.php @@ -35,11 +35,10 @@ class EasterMondayTest extends SlovakiaBaseTestCase implements HolidayTestCase /** * Tests the holiday defined in this test. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,7 +51,7 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $timezone = self::TIMEZONE; @@ -78,7 +77,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Veľkonočný pondelok'] ); } @@ -90,6 +89,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/Slovakia/EpiphanyTest.php b/tests/Slovakia/EpiphanyTest.php index 14a8fb822..c2c6b1d74 100644 --- a/tests/Slovakia/EpiphanyTest.php +++ b/tests/Slovakia/EpiphanyTest.php @@ -35,11 +35,10 @@ class EpiphanyTest extends SlovakiaBaseTestCase implements HolidayTestCase /** * Tests the holiday defined in this test. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,9 +51,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -67,7 +66,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Zjavenie Pána / Traja králi'] ); } @@ -79,6 +78,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/Slovakia/GoodFridayTest.php b/tests/Slovakia/GoodFridayTest.php index b9dd4be97..7b51c4487 100644 --- a/tests/Slovakia/GoodFridayTest.php +++ b/tests/Slovakia/GoodFridayTest.php @@ -35,11 +35,10 @@ class GoodFridayTest extends SlovakiaBaseTestCase implements HolidayTestCase /** * Tests the holiday defined in this test. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,7 +51,7 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $timezone = self::TIMEZONE; @@ -78,7 +77,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Veľký piatok'] ); } @@ -90,6 +89,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/Slovakia/InternationalWorkersDayTest.php b/tests/Slovakia/InternationalWorkersDayTest.php index eaf380ba3..30e2b8d42 100644 --- a/tests/Slovakia/InternationalWorkersDayTest.php +++ b/tests/Slovakia/InternationalWorkersDayTest.php @@ -35,11 +35,10 @@ class InternationalWorkersDayTest extends SlovakiaBaseTestCase implements Holida /** * Tests the holiday defined in this test. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,9 +51,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } /** @@ -67,7 +66,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Sviatok práce'] ); } @@ -79,6 +78,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/Slovakia/OurLadyOfSorrowsDayTest.php b/tests/Slovakia/OurLadyOfSorrowsDayTest.php index 3b21c5df5..2f8f2b292 100644 --- a/tests/Slovakia/OurLadyOfSorrowsDayTest.php +++ b/tests/Slovakia/OurLadyOfSorrowsDayTest.php @@ -32,11 +32,10 @@ class OurLadyOfSorrowsDayTest extends SlovakiaBaseTestCase implements HolidayTes /** * Tests the holiday defined in this test. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which this holiday needs to be tested * @param string $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, $expected): void { $this->assertHoliday( @@ -54,13 +53,15 @@ public function testHoliday(int $year, $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDatesWithModifier(9, 15, function ($year, \DateTime $date): void { + return static::generateRandomDatesWithModifier(9, 15, function ($year, \DateTime $date): ?bool { // Our Lady of Sorrows Day is not observed in 2025 and 2026 if (in_array($year, [2025, 2026])) { - return; + return false; } + + return null; }, 5, 1000, self::TIMEZONE); } @@ -73,7 +74,7 @@ public function testTranslation(): void { // Our Lady of Sorrows Day is not observed in 2025 and 2026 $validYears = array_merge(range(1993, 2024), range(2027, 2100)); - $year = $this->randomYearFromArray($validYears); + $year = static::randomYearFromArray($validYears); $this->assertTranslatedHolidayName( self::REGION, @@ -92,7 +93,7 @@ public function testHolidayType(): void { // Our Lady of Sorrows Day is not observed in 2025 and 2026 $validYears = array_merge(range(1993, 2024), range(2027, 2100)); - $year = $this->randomYearFromArray($validYears); + $year = static::randomYearFromArray($validYears); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_BANK); } diff --git a/tests/Slovakia/SaintsCyrilAndMethodiusDayTest.php b/tests/Slovakia/SaintsCyrilAndMethodiusDayTest.php index 120dc52b2..c69f57e66 100644 --- a/tests/Slovakia/SaintsCyrilAndMethodiusDayTest.php +++ b/tests/Slovakia/SaintsCyrilAndMethodiusDayTest.php @@ -35,11 +35,10 @@ class SaintsCyrilAndMethodiusDayTest extends SlovakiaBaseTestCase implements Hol /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,9 +51,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(7, 5, self::TIMEZONE); + return static::generateRandomDates(7, 5, self::TIMEZONE); } /** @@ -67,7 +66,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Sviatok svätého Cyrila a Metoda'] ); } @@ -79,6 +78,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovakia/SecondChristmasDayTest.php b/tests/Slovakia/SecondChristmasDayTest.php index 6caacd8a2..634f6c386 100644 --- a/tests/Slovakia/SecondChristmasDayTest.php +++ b/tests/Slovakia/SecondChristmasDayTest.php @@ -35,11 +35,10 @@ class SecondChristmasDayTest extends SlovakiaBaseTestCase implements HolidayTest /** * Tests the holiday defined in this test. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,9 +51,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -67,7 +66,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Druhý sviatok vianočný'] ); } @@ -79,6 +78,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/Slovakia/SlovakConstitutionDayTest.php b/tests/Slovakia/SlovakConstitutionDayTest.php index 22476a6b4..01b93c2c9 100644 --- a/tests/Slovakia/SlovakConstitutionDayTest.php +++ b/tests/Slovakia/SlovakConstitutionDayTest.php @@ -35,11 +35,10 @@ class SlovakConstitutionDayTest extends SlovakiaBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { if ($year < 2024) { @@ -56,9 +55,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(9, 1, self::TIMEZONE); + return static::generateRandomDates(9, 1, self::TIMEZONE); } /** @@ -71,7 +70,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(null, 2013), + static::generateRandomYear(null, 2013), [self::LOCALE => 'Deň Ústavy Slovenskej republiky'] ); } @@ -83,6 +82,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(null, 2013), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(null, 2013), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovakia/SlovakIndependenceDayTest.php b/tests/Slovakia/SlovakIndependenceDayTest.php index 0f99e2704..8a838343e 100644 --- a/tests/Slovakia/SlovakIndependenceDayTest.php +++ b/tests/Slovakia/SlovakIndependenceDayTest.php @@ -36,11 +36,10 @@ class SlovakIndependenceDayTest extends SlovakiaBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,9 +52,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -68,7 +67,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Deň vzniku Slovenskej republiky'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovakia/SlovakNationalUprisingDayTest.php b/tests/Slovakia/SlovakNationalUprisingDayTest.php index ef19faae4..c503f30a6 100644 --- a/tests/Slovakia/SlovakNationalUprisingDayTest.php +++ b/tests/Slovakia/SlovakNationalUprisingDayTest.php @@ -35,11 +35,10 @@ class SlovakNationalUprisingDayTest extends SlovakiaBaseTestCase implements Holi /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,9 +51,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 29, self::TIMEZONE); + return static::generateRandomDates(8, 29, self::TIMEZONE); } /** @@ -67,7 +66,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Výročie Slovenského národného povstania'] ); } @@ -79,6 +78,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovakia/SlovakiaTest.php b/tests/Slovakia/SlovakiaTest.php index cd1416ca1..5e9a340d1 100644 --- a/tests/Slovakia/SlovakiaTest.php +++ b/tests/Slovakia/SlovakiaTest.php @@ -44,8 +44,8 @@ class SlovakiaTest extends SlovakiaBaseTestCase implements ProviderTestCase protected function setUp(): void { // NOTE: 1993 is the year Slovakia was founded as an independent state - $this->year = $this->generateRandomYear(1993, 2100); - $this->yearOfConsolidation = $this->generateRandomYear(1993, 2024); + $this->year = static::generateRandomYear(1993, 2100); + $this->yearOfConsolidation = static::generateRandomYear(1993, 2024); } /** diff --git a/tests/Slovakia/StruggleForFreedomAndDemocracyDayTest.php b/tests/Slovakia/StruggleForFreedomAndDemocracyDayTest.php index b76b763b0..3bcee77d0 100644 --- a/tests/Slovakia/StruggleForFreedomAndDemocracyDayTest.php +++ b/tests/Slovakia/StruggleForFreedomAndDemocracyDayTest.php @@ -35,11 +35,10 @@ class StruggleForFreedomAndDemocracyDayTest extends SlovakiaBaseTestCase impleme /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -52,7 +51,7 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { // Only use years between 1993 and 2024 $years = range(1993, 2024); @@ -78,7 +77,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1993, 2024), + static::generateRandomYear(1993, 2024), [self::LOCALE => 'Deň boja za slobodu a demokraciu'] ); } @@ -90,6 +89,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1993, 2024), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(1993, 2024), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovakia/VictoryInEuropeDayTest.php b/tests/Slovakia/VictoryInEuropeDayTest.php index 76a2b7336..d364c1923 100644 --- a/tests/Slovakia/VictoryInEuropeDayTest.php +++ b/tests/Slovakia/VictoryInEuropeDayTest.php @@ -35,11 +35,10 @@ class VictoryInEuropeDayTest extends SlovakiaBaseTestCase implements HolidayTest /** * Tests Christmas Day. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which this holiday needs to be tested * @param string $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,15 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDatesWithModifier(5, 8, function ($year, \DateTime $date): void { + return static::generateRandomDatesWithModifier(5, 8, function ($year, \DateTime $date): ?bool { // Victory in Europe Day is not observed in 2025 and 2026 if (in_array($year, [2025, 2026])) { - return; + return false; } + + return null; }, 5, 1000, self::TIMEZONE); } @@ -76,7 +77,7 @@ public function testTranslation(): void { // Victory in Europe Day is not observed in 2025 and 2026 $validYears = array_merge(range(1993, 2024), range(2027, 2100)); - $year = $this->randomYearFromArray($validYears); + $year = static::randomYearFromArray($validYears); $this->assertTranslatedHolidayName( self::REGION, @@ -95,7 +96,7 @@ public function testHolidayType(): void { // Victory in Europe Day is not observed in 2025 and 2026 $validYears = array_merge(range(1993, 2024), range(2027, 2100)); - $year = $this->randomYearFromArray($validYears); + $year = static::randomYearFromArray($validYears); $this->assertHolidayType(self::REGION, self::HOLIDAY, $year, Holiday::TYPE_BANK); } diff --git a/tests/Slovenia/AssumptionOfMaryTest.php b/tests/Slovenia/AssumptionOfMaryTest.php index bd540415f..2a8055661 100644 --- a/tests/Slovenia/AssumptionOfMaryTest.php +++ b/tests/Slovenia/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends SloveniaBaseTestCase implements HolidayTestCa /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Marijino vnebovzetje'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovenia/ChristmasDayTest.php b/tests/Slovenia/ChristmasDayTest.php index ef41be775..21770cde3 100644 --- a/tests/Slovenia/ChristmasDayTest.php +++ b/tests/Slovenia/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends SloveniaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Božič'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovenia/EasterMondayTest.php b/tests/Slovenia/EasterMondayTest.php index 983c9379d..774fe5309 100644 --- a/tests/Slovenia/EasterMondayTest.php +++ b/tests/Slovenia/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Velikonočni ponedeljek'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovenia/EasterTest.php b/tests/Slovenia/EasterTest.php index 33b21b852..6249dc4d1 100644 --- a/tests/Slovenia/EasterTest.php +++ b/tests/Slovenia/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Velika noč'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovenia/IndependenceDayTest.php b/tests/Slovenia/IndependenceDayTest.php index ab11b0fb8..bf36a57f4 100644 --- a/tests/Slovenia/IndependenceDayTest.php +++ b/tests/Slovenia/IndependenceDayTest.php @@ -42,7 +42,7 @@ class IndependenceDayTest extends SloveniaBaseTestCase implements HolidayTestCas */ public function testIndependenceDay(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testIndependenceDayBefore1991(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dan samostojnosti in enotnosti'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Slovenia/InternationalWorkersDayTest.php b/tests/Slovenia/InternationalWorkersDayTest.php index b163920eb..ff6211abd 100644 --- a/tests/Slovenia/InternationalWorkersDayTest.php +++ b/tests/Slovenia/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends SloveniaBaseTestCase implements Holida /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Praznik dela'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovenia/LabourDayTest.php b/tests/Slovenia/LabourDayTest.php index 4b23a5adb..4e67ca574 100644 --- a/tests/Slovenia/LabourDayTest.php +++ b/tests/Slovenia/LabourDayTest.php @@ -33,11 +33,10 @@ class LabourDayTest extends SloveniaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 2, self::TIMEZONE); + return static::generateRandomDates(5, 2, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Praznik dela (2. dan)'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovenia/NewYearsDayTest.php b/tests/Slovenia/NewYearsDayTest.php index 8510050f7..506797eb6 100644 --- a/tests/Slovenia/NewYearsDayTest.php +++ b/tests/Slovenia/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends SloveniaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Novo leto'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovenia/PentecostTest.php b/tests/Slovenia/PentecostTest.php index 09f453e02..d584faba6 100644 --- a/tests/Slovenia/PentecostTest.php +++ b/tests/Slovenia/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Binkoštna nedelja'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovenia/PreserenDayTest.php b/tests/Slovenia/PreserenDayTest.php index b865f182a..e50fff0cc 100644 --- a/tests/Slovenia/PreserenDayTest.php +++ b/tests/Slovenia/PreserenDayTest.php @@ -42,7 +42,7 @@ class PreserenDayTest extends SloveniaBaseTestCase implements HolidayTestCase */ public function testPreserenDay(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testPreserenDayBefore1991(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Prešernov dan, slovenski kulturni praznik'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Slovenia/ReformationDayTest.php b/tests/Slovenia/ReformationDayTest.php index f3017555c..1015a9af2 100644 --- a/tests/Slovenia/ReformationDayTest.php +++ b/tests/Slovenia/ReformationDayTest.php @@ -42,7 +42,7 @@ class ReformationDayTest extends SloveniaBaseTestCase implements HolidayTestCase */ public function testReformationDay(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testReformationDayBefore1992(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dan reformacije'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Slovenia/RemembranceDayTest.php b/tests/Slovenia/RemembranceDayTest.php index 0b8d916a5..799a72717 100644 --- a/tests/Slovenia/RemembranceDayTest.php +++ b/tests/Slovenia/RemembranceDayTest.php @@ -33,11 +33,10 @@ class RemembranceDayTest extends SloveniaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Dan spomina na mrtve'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovenia/SecondNewYearsDayTest.php b/tests/Slovenia/SecondNewYearsDayTest.php index 2029c086e..8f834ace5 100644 --- a/tests/Slovenia/SecondNewYearsDayTest.php +++ b/tests/Slovenia/SecondNewYearsDayTest.php @@ -33,11 +33,10 @@ class SecondNewYearsDayTest extends SloveniaBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 2, self::TIMEZONE); + return static::generateRandomDates(1, 2, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Novo leto (2. dan)'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Slovenia/SloveniaTest.php b/tests/Slovenia/SloveniaTest.php index 324542ac6..5c564b6dd 100644 --- a/tests/Slovenia/SloveniaTest.php +++ b/tests/Slovenia/SloveniaTest.php @@ -37,7 +37,7 @@ class SloveniaTest extends SloveniaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1992); + $this->year = static::generateRandomYear(1992); } /** diff --git a/tests/Slovenia/StatehoodDayTest.php b/tests/Slovenia/StatehoodDayTest.php index f90d4bfa5..764dfd7b5 100644 --- a/tests/Slovenia/StatehoodDayTest.php +++ b/tests/Slovenia/StatehoodDayTest.php @@ -42,7 +42,7 @@ class StatehoodDayTest extends SloveniaBaseTestCase implements HolidayTestCase */ public function testStatehoodDay(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testStatehoodDayBefore1991(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dan državnosti'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Slovenia/UprisingAgainstOccupationTest.php b/tests/Slovenia/UprisingAgainstOccupationTest.php index 9ece0c175..d481e5633 100644 --- a/tests/Slovenia/UprisingAgainstOccupationTest.php +++ b/tests/Slovenia/UprisingAgainstOccupationTest.php @@ -42,7 +42,7 @@ class UprisingAgainstOccupationTest extends SloveniaBaseTestCase implements Holi */ public function testUprisingAgainstOccupation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testUprisingAgainstOccupationBefore1945(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dan upora proti okupatorju'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/ChristmasDayTest.php b/tests/SouthAfrica/ChristmasDayTest.php index 0f5e44b23..d068c1d0d 100644 --- a/tests/SouthAfrica/ChristmasDayTest.php +++ b/tests/SouthAfrica/ChristmasDayTest.php @@ -42,13 +42,12 @@ class ChristmasDayTest extends SouthAfricaBaseTestCase implements HolidayTestCas /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -68,12 +67,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-12-25", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -91,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Christmas Day'] ); } @@ -120,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/FamilyDayTest.php b/tests/SouthAfrica/FamilyDayTest.php index 9b1e6bd11..6f3d96e03 100644 --- a/tests/SouthAfrica/FamilyDayTest.php +++ b/tests/SouthAfrica/FamilyDayTest.php @@ -42,13 +42,12 @@ class FamilyDayTest extends SouthAfricaBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -66,13 +65,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); + $date = static::computeEaster($year, self::TIMEZONE); $date->add(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; } @@ -90,7 +89,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -104,7 +103,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Family Day'] ); } @@ -119,7 +118,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/FreedomDayTest.php b/tests/SouthAfrica/FreedomDayTest.php index 40900f577..c182defed 100644 --- a/tests/SouthAfrica/FreedomDayTest.php +++ b/tests/SouthAfrica/FreedomDayTest.php @@ -42,13 +42,12 @@ class FreedomDayTest extends SouthAfricaBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -68,12 +67,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-4-27", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -91,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Freedom Day'] ); } @@ -120,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/GoodFridayTest.php b/tests/SouthAfrica/GoodFridayTest.php index 35c26318f..6904730e2 100644 --- a/tests/SouthAfrica/GoodFridayTest.php +++ b/tests/SouthAfrica/GoodFridayTest.php @@ -42,13 +42,12 @@ class GoodFridayTest extends SouthAfricaBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -66,13 +65,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); + $date = static::computeEaster($year, self::TIMEZONE); $date->sub(new \DateInterval('P2D')); $data[] = [$year, $date->format('Y-m-d')]; } @@ -90,7 +89,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -104,7 +103,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Good Friday'] ); } @@ -119,7 +118,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/HeritageDayTest.php b/tests/SouthAfrica/HeritageDayTest.php index 5417b8f4f..690c19235 100644 --- a/tests/SouthAfrica/HeritageDayTest.php +++ b/tests/SouthAfrica/HeritageDayTest.php @@ -42,13 +42,12 @@ class HeritageDayTest extends SouthAfricaBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -68,12 +67,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-9-24", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -91,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Heritage Day'] ); } @@ -120,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/HumanRightsDayTest.php b/tests/SouthAfrica/HumanRightsDayTest.php index 3baf7d995..3bfbc6f9d 100644 --- a/tests/SouthAfrica/HumanRightsDayTest.php +++ b/tests/SouthAfrica/HumanRightsDayTest.php @@ -42,13 +42,12 @@ class HumanRightsDayTest extends SouthAfricaBaseTestCase implements HolidayTestC /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -68,12 +67,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-3-21", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -91,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Human Rights Day'] ); } @@ -120,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/MunicipalElections2016DayTest.php b/tests/SouthAfrica/MunicipalElections2016DayTest.php index 0cc8ef089..f88db38b8 100644 --- a/tests/SouthAfrica/MunicipalElections2016DayTest.php +++ b/tests/SouthAfrica/MunicipalElections2016DayTest.php @@ -64,7 +64,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testHolidayDayAfterCompletion(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR + 1)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR + 1)); } /** @@ -88,7 +88,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), [self::LOCALE => '2016 Municipal Elections Day'] ); } @@ -103,7 +103,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/NationalWomensDayTest.php b/tests/SouthAfrica/NationalWomensDayTest.php index c8bbdc7ef..bfd0f7dd9 100644 --- a/tests/SouthAfrica/NationalWomensDayTest.php +++ b/tests/SouthAfrica/NationalWomensDayTest.php @@ -42,13 +42,12 @@ class NationalWomensDayTest extends SouthAfricaBaseTestCase implements HolidayTe /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -68,12 +67,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-8-9", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -91,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'National Women’s Day'] ); } @@ -120,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/NewYearsDayTest.php b/tests/SouthAfrica/NewYearsDayTest.php index c3cd24cf7..87c65a80d 100644 --- a/tests/SouthAfrica/NewYearsDayTest.php +++ b/tests/SouthAfrica/NewYearsDayTest.php @@ -42,13 +42,12 @@ class NewYearsDayTest extends SouthAfricaBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -68,12 +67,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-1-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -91,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'New Year’s Day'] ); } @@ -120,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/ReconciliationDayTest.php b/tests/SouthAfrica/ReconciliationDayTest.php index 1e0d784ad..0ba83c970 100644 --- a/tests/SouthAfrica/ReconciliationDayTest.php +++ b/tests/SouthAfrica/ReconciliationDayTest.php @@ -42,13 +42,12 @@ class ReconciliationDayTest extends SouthAfricaBaseTestCase implements HolidayTe /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -68,12 +67,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-12-16", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -91,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Day of Reconciliation'] ); } @@ -120,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/SecondChristmasDayTest.php b/tests/SouthAfrica/SecondChristmasDayTest.php index f4e05c6c1..4569e3b92 100644 --- a/tests/SouthAfrica/SecondChristmasDayTest.php +++ b/tests/SouthAfrica/SecondChristmasDayTest.php @@ -42,13 +42,12 @@ class SecondChristmasDayTest extends SouthAfricaBaseTestCase implements HolidayT /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -68,12 +67,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-12-26", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -91,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Day of Goodwill'] ); } @@ -120,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/SouthAfricaTest.php b/tests/SouthAfrica/SouthAfricaTest.php index 559a4d1ac..4b189eb4a 100644 --- a/tests/SouthAfrica/SouthAfricaTest.php +++ b/tests/SouthAfrica/SouthAfricaTest.php @@ -39,7 +39,7 @@ class SouthAfricaTest extends SouthAfricaBaseTestCase implements ProviderTestCas */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1994); + $this->year = static::generateRandomYear(1994); } /** diff --git a/tests/SouthAfrica/SubstituteDayOfGoodwillTest.php b/tests/SouthAfrica/SubstituteDayOfGoodwillTest.php index d2cfdda1d..c63fa619a 100644 --- a/tests/SouthAfrica/SubstituteDayOfGoodwillTest.php +++ b/tests/SouthAfrica/SubstituteDayOfGoodwillTest.php @@ -64,7 +64,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testHolidayDayAfterCompletion(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR + 1)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR + 1)); } /** @@ -88,7 +88,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Day of Goodwill observed'] ); } @@ -103,7 +103,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/WorkersDayTest.php b/tests/SouthAfrica/WorkersDayTest.php index 762d1cc4f..7c75f6657 100644 --- a/tests/SouthAfrica/WorkersDayTest.php +++ b/tests/SouthAfrica/WorkersDayTest.php @@ -42,13 +42,12 @@ class WorkersDayTest extends SouthAfricaBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -68,12 +67,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-5-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -91,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Workers’ Day'] ); } @@ -120,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthAfrica/YouthDayTest.php b/tests/SouthAfrica/YouthDayTest.php index c55a09ecc..df2d5992c 100644 --- a/tests/SouthAfrica/YouthDayTest.php +++ b/tests/SouthAfrica/YouthDayTest.php @@ -42,13 +42,12 @@ class YouthDayTest extends SouthAfricaBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -68,12 +67,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-6-16", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -91,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Youth Day'] ); } @@ -120,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthKorea/ArborDayTest.php b/tests/SouthKorea/ArborDayTest.php index 120393fb9..4c42d67e2 100644 --- a/tests/SouthKorea/ArborDayTest.php +++ b/tests/SouthKorea/ArborDayTest.php @@ -51,7 +51,7 @@ class ArborDayTest extends SouthKoreaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); $date = (self::TEMPORARY_CHANGED_YEAR === $year) ? new \DateTime("{$year}-3-21", new \DateTimeZone(self::TIMEZONE)) : new \DateTime("{$year}-4-5", new \DateTimeZone(self::TIMEZONE)); @@ -74,7 +74,7 @@ public function testHolidayAfterRemoval(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::REMOVED_YEAR + 1) + static::generateRandomYear(self::REMOVED_YEAR + 1) ); } @@ -88,7 +88,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -99,7 +99,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); $translation = (self::TEMPORARY_CHANGED_YEAR === $year) ? '사방의 날' : '식목일'; $this->assertTranslatedHolidayName( @@ -117,7 +117,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); $this->assertHolidayType( self::REGION, self::HOLIDAY, diff --git a/tests/SouthKorea/ArmedForcesDayTest.php b/tests/SouthKorea/ArmedForcesDayTest.php index 654e60592..c94c8d96f 100644 --- a/tests/SouthKorea/ArmedForcesDayTest.php +++ b/tests/SouthKorea/ArmedForcesDayTest.php @@ -47,7 +47,7 @@ class ArmedForcesDayTest extends SouthKoreaBaseTestCase implements HolidayTestCa */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -66,7 +66,7 @@ public function testHolidayAfterRemoval(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::REMOVED_YEAR + 1) + static::generateRandomYear(self::REMOVED_YEAR + 1) ); } @@ -80,7 +80,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -94,7 +94,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), [self::LOCALE => '국군의 날'] ); } @@ -109,7 +109,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthKorea/BuddhasBirthdayTest.php b/tests/SouthKorea/BuddhasBirthdayTest.php index 693a27346..8f205defc 100644 --- a/tests/SouthKorea/BuddhasBirthdayTest.php +++ b/tests/SouthKorea/BuddhasBirthdayTest.php @@ -47,7 +47,7 @@ class BuddhasBirthdayTest extends SouthKoreaBaseTestCase implements HolidayTestC */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -59,13 +59,12 @@ public function testHoliday(): void /** * Tests substitute holidays. * - * @dataProvider SubstituteHolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param ?string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('SubstituteHolidayDataProvider')] public function testSubstituteHoliday(int $year, ?string $expected): void { if ($expected) { @@ -94,7 +93,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -105,7 +104,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, @@ -121,7 +120,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); $this->assertHolidayType( self::REGION, self::HOLIDAY, @@ -135,7 +134,7 @@ public function testHolidayType(): void * * @return array list of test dates for the holiday defined in this test */ - public function SubstituteHolidayDataProvider(): array + public static function SubstituteHolidayDataProvider(): array { return [ [1975, null], diff --git a/tests/SouthKorea/ChildrensDayTest.php b/tests/SouthKorea/ChildrensDayTest.php index 60fd77933..0d9d184e9 100644 --- a/tests/SouthKorea/ChildrensDayTest.php +++ b/tests/SouthKorea/ChildrensDayTest.php @@ -42,7 +42,7 @@ class ChildrensDayTest extends SouthKoreaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -122,7 +122,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -136,7 +136,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '어린이날'] ); } @@ -151,7 +151,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthKorea/ChristmasDayTest.php b/tests/SouthKorea/ChristmasDayTest.php index 99893a03e..3f3c231cc 100644 --- a/tests/SouthKorea/ChristmasDayTest.php +++ b/tests/SouthKorea/ChristmasDayTest.php @@ -42,7 +42,7 @@ class ChristmasDayTest extends SouthKoreaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -54,13 +54,12 @@ public function testHoliday(): void /** * Tests substitute holidays. * - * @dataProvider SubstituteHolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param ?string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('SubstituteHolidayDataProvider')] public function testSubstituteHoliday(int $year, ?string $expected): void { if ($expected) { @@ -89,7 +88,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -103,7 +102,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '기독탄신일'] ); } @@ -118,7 +117,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } @@ -128,7 +127,7 @@ public function testHolidayType(): void * * @return array list of test dates for the holiday defined in this test */ - public function SubstituteHolidayDataProvider(): array + public static function SubstituteHolidayDataProvider(): array { return [ [1949, null], diff --git a/tests/SouthKorea/ChuseokTest.php b/tests/SouthKorea/ChuseokTest.php index 77d9e7d74..fbc6b71a3 100644 --- a/tests/SouthKorea/ChuseokTest.php +++ b/tests/SouthKorea/ChuseokTest.php @@ -47,7 +47,7 @@ class ChuseokTest extends SouthKoreaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); $date = new \DateTime(self::LUNAR_HOLIDAY[self::HOLIDAY][$year], new \DateTimeZone(self::TIMEZONE)); // Chuseok @@ -166,7 +166,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -177,7 +177,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); $this->assertTranslatedHolidayName( self::REGION, @@ -212,7 +212,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); $this->assertHolidayType( self::REGION, diff --git a/tests/SouthKorea/ConstitutionDayTest.php b/tests/SouthKorea/ConstitutionDayTest.php index 4bad0760e..a5422706c 100644 --- a/tests/SouthKorea/ConstitutionDayTest.php +++ b/tests/SouthKorea/ConstitutionDayTest.php @@ -47,7 +47,7 @@ class ConstitutionDayTest extends SouthKoreaBaseTestCase implements HolidayTestC */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -66,7 +66,7 @@ public function testHolidayAfterRemoval(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::REMOVED_YEAR + 1) + static::generateRandomYear(self::REMOVED_YEAR + 1) ); } @@ -80,7 +80,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -94,7 +94,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), [self::LOCALE => '제헌절'] ); } @@ -109,7 +109,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthKorea/GaecheonjeolTest.php b/tests/SouthKorea/GaecheonjeolTest.php index 20782fac3..87fd0c1b5 100644 --- a/tests/SouthKorea/GaecheonjeolTest.php +++ b/tests/SouthKorea/GaecheonjeolTest.php @@ -42,7 +42,7 @@ class GaecheonjeolTest extends SouthKoreaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -123,7 +123,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -137,7 +137,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '개천절'] ); } @@ -152,7 +152,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthKorea/HangulDayTest.php b/tests/SouthKorea/HangulDayTest.php index cfbd01d68..866b166af 100644 --- a/tests/SouthKorea/HangulDayTest.php +++ b/tests/SouthKorea/HangulDayTest.php @@ -42,7 +42,7 @@ class HangulDayTest extends SouthKoreaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); if ($year > 1990 && $year <= 2012) { $this->assertNotHoliday( self::REGION, @@ -104,7 +104,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -115,15 +115,12 @@ public function testHolidayBeforeEstablishment(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); - if ($year <= 1990 || $year > 2012) { - $this->assertTranslatedHolidayName( - self::REGION, - self::HOLIDAY, - $year, - [self::LOCALE => '한글날'] - ); - } + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(2013), + [self::LOCALE => '한글날'] + ); } /** @@ -133,14 +130,11 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); - if ($year <= 1990 || $year > 2012) { - $this->assertHolidayType( - self::REGION, - self::HOLIDAY, - $year, - Holiday::TYPE_OFFICIAL - ); - } + $this->assertHolidayType( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(2013), + Holiday::TYPE_OFFICIAL + ); } } diff --git a/tests/SouthKorea/IndependenceMovementDayTest.php b/tests/SouthKorea/IndependenceMovementDayTest.php index 090f50a94..2e5727041 100644 --- a/tests/SouthKorea/IndependenceMovementDayTest.php +++ b/tests/SouthKorea/IndependenceMovementDayTest.php @@ -42,7 +42,7 @@ class IndependenceMovementDayTest extends SouthKoreaBaseTestCase implements Holi */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -103,7 +103,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -117,7 +117,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '삼일절'] ); } @@ -132,7 +132,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthKorea/LiberationDayTest.php b/tests/SouthKorea/LiberationDayTest.php index 7c5b07e2a..b66b87e30 100644 --- a/tests/SouthKorea/LiberationDayTest.php +++ b/tests/SouthKorea/LiberationDayTest.php @@ -42,7 +42,7 @@ class LiberationDayTest extends SouthKoreaBaseTestCase implements HolidayTestCas */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -98,7 +98,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -112,7 +112,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '광복절'] ); } @@ -127,7 +127,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthKorea/MemorialDayTest.php b/tests/SouthKorea/MemorialDayTest.php index 7ec035c50..e46d9ddc4 100644 --- a/tests/SouthKorea/MemorialDayTest.php +++ b/tests/SouthKorea/MemorialDayTest.php @@ -42,7 +42,7 @@ class MemorialDayTest extends SouthKoreaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '현충일'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthKorea/NewYearsDayTest.php b/tests/SouthKorea/NewYearsDayTest.php index 7f7651b05..64961930f 100644 --- a/tests/SouthKorea/NewYearsDayTest.php +++ b/tests/SouthKorea/NewYearsDayTest.php @@ -42,7 +42,7 @@ class NewYearsDayTest extends SouthKoreaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-1-1", new \DateTimeZone(self::TIMEZONE)); // New Year's Day @@ -59,7 +59,7 @@ public function testHoliday(): void } // Two days later New Year's Day - if ($year <= 1990) { + if ($year <= 1989) { $this->assertHoliday( self::REGION, 'twoDaysLaterNewYearsDay', @@ -79,12 +79,12 @@ public function testHolidayAfterRemoval(): void $this->assertNotHoliday( self::REGION, 'dayAfterNewYearsDay', - $this->generateRandomYear(1999) + static::generateRandomYear(1999) ); $this->assertNotHoliday( self::REGION, 'twoDaysLaterNewYearsDay', - $this->generateRandomYear(1991) + static::generateRandomYear(1990) ); } @@ -98,7 +98,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -112,19 +112,19 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '새해'] ); $this->assertTranslatedHolidayName( self::REGION, 'dayAfterNewYearsDay', - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1998), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1998), [self::LOCALE => '새해 연휴'] ); $this->assertTranslatedHolidayName( self::REGION, 'twoDaysLaterNewYearsDay', - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1989), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1989), [self::LOCALE => '새해 연휴'] ); } @@ -139,19 +139,19 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); $this->assertHolidayType( self::REGION, 'dayAfterNewYearsDay', - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1998), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1998), Holiday::TYPE_OFFICIAL ); $this->assertHolidayType( self::REGION, 'twoDaysLaterNewYearsDay', - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1989), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1989), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/SouthKorea/SeollalTest.php b/tests/SouthKorea/SeollalTest.php index 77169c208..c0c081bb4 100644 --- a/tests/SouthKorea/SeollalTest.php +++ b/tests/SouthKorea/SeollalTest.php @@ -47,7 +47,7 @@ class SeollalTest extends SouthKoreaBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); $date = new \DateTime(self::LUNAR_HOLIDAY[self::HOLIDAY][$year], new \DateTimeZone(self::TIMEZONE)); if ($year >= 1985) { @@ -122,7 +122,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -133,7 +133,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testTranslation(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); $this->assertTranslatedHolidayName( self::REGION, @@ -165,7 +165,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::LUNAR_TEST_LIMIT); $this->assertHolidayType( self::REGION, diff --git a/tests/SouthKorea/SouthKoreaTest.php b/tests/SouthKorea/SouthKoreaTest.php index 3de5f26cf..b1d0195fa 100644 --- a/tests/SouthKorea/SouthKoreaTest.php +++ b/tests/SouthKorea/SouthKoreaTest.php @@ -44,7 +44,7 @@ class SouthKoreaTest extends SouthKoreaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1949, self::LUNAR_TEST_LIMIT); + $this->year = static::generateRandomYear(1949, self::LUNAR_TEST_LIMIT); } /** diff --git a/tests/SouthKorea/UnitedNationsDayTest.php b/tests/SouthKorea/UnitedNationsDayTest.php index 0c7d65a8d..79fc9b5bd 100644 --- a/tests/SouthKorea/UnitedNationsDayTest.php +++ b/tests/SouthKorea/UnitedNationsDayTest.php @@ -47,7 +47,7 @@ class UnitedNationsDayTest extends SouthKoreaBaseTestCase implements HolidayTest */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -66,7 +66,7 @@ public function testHolidayAfterRemoval(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::REMOVED_YEAR + 1) + static::generateRandomYear(self::REMOVED_YEAR + 1) ); } @@ -80,7 +80,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -94,7 +94,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), [self::LOCALE => '유엔의 날'] ); } @@ -109,7 +109,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::REMOVED_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/AllSaintsDayTest.php b/tests/Spain/AllSaintsDayTest.php index 7a268763f..a888992e9 100644 --- a/tests/Spain/AllSaintsDayTest.php +++ b/tests/Spain/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends SpainBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Día de todos los Santos'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Spain/Andalusia/AndalusiaDayTest.php b/tests/Spain/Andalusia/AndalusiaDayTest.php index 28af2ce22..cd80d8e02 100644 --- a/tests/Spain/Andalusia/AndalusiaDayTest.php +++ b/tests/Spain/Andalusia/AndalusiaDayTest.php @@ -42,7 +42,7 @@ class AndalusiaDayTest extends AndalusiaBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de Andalucía'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/Andalusia/AndalusiaTest.php b/tests/Spain/Andalusia/AndalusiaTest.php index 61c7fad3e..adb91d8b5 100644 --- a/tests/Spain/Andalusia/AndalusiaTest.php +++ b/tests/Spain/Andalusia/AndalusiaTest.php @@ -37,7 +37,7 @@ class AndalusiaTest extends AndalusiaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/Aragon/AragonTest.php b/tests/Spain/Aragon/AragonTest.php index 16095e074..907b8b6ee 100644 --- a/tests/Spain/Aragon/AragonTest.php +++ b/tests/Spain/Aragon/AragonTest.php @@ -37,7 +37,7 @@ class AragonTest extends AragonBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/Aragon/StGeorgesDayTest.php b/tests/Spain/Aragon/StGeorgesDayTest.php index d88abb109..8699312df 100644 --- a/tests/Spain/Aragon/StGeorgesDayTest.php +++ b/tests/Spain/Aragon/StGeorgesDayTest.php @@ -37,7 +37,7 @@ class StGeorgesDayTest extends AragonBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'San Jorge'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Spain/AssumptionOfMaryTest.php b/tests/Spain/AssumptionOfMaryTest.php index 63e9ad7e4..f09e2900b 100644 --- a/tests/Spain/AssumptionOfMaryTest.php +++ b/tests/Spain/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends SpainBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Asunción de la Virgen María'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Spain/Asturias/AsturiasDayTest.php b/tests/Spain/Asturias/AsturiasDayTest.php index 3250f568b..4f4f04d81 100644 --- a/tests/Spain/Asturias/AsturiasDayTest.php +++ b/tests/Spain/Asturias/AsturiasDayTest.php @@ -42,7 +42,7 @@ class AsturiasDayTest extends AsturiasBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de Asturias'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/Asturias/AsturiasTest.php b/tests/Spain/Asturias/AsturiasTest.php index 601a34520..0727ebb59 100644 --- a/tests/Spain/Asturias/AsturiasTest.php +++ b/tests/Spain/Asturias/AsturiasTest.php @@ -37,7 +37,7 @@ class AsturiasTest extends AsturiasBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1984); + $this->year = static::generateRandomYear(1984); } /** diff --git a/tests/Spain/BalearicIslands/BalearicIslandsDayTest.php b/tests/Spain/BalearicIslands/BalearicIslandsDayTest.php index 6c515f5d6..ea0e917fb 100644 --- a/tests/Spain/BalearicIslands/BalearicIslandsDayTest.php +++ b/tests/Spain/BalearicIslands/BalearicIslandsDayTest.php @@ -42,7 +42,7 @@ class BalearicIslandsDayTest extends BalearicIslandsBaseTestCase implements Holi */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de les Illes Balears'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/BalearicIslands/BalearicIslandsTest.php b/tests/Spain/BalearicIslands/BalearicIslandsTest.php index 2c8bb1d66..8a139765d 100644 --- a/tests/Spain/BalearicIslands/BalearicIslandsTest.php +++ b/tests/Spain/BalearicIslands/BalearicIslandsTest.php @@ -37,7 +37,7 @@ class BalearicIslandsTest extends BalearicIslandsBaseTestCase implements Provide */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/BasqueCountry/BasqueCountryDayTest.php b/tests/Spain/BasqueCountry/BasqueCountryDayTest.php index 5ae19fe02..7749e6de6 100644 --- a/tests/Spain/BasqueCountry/BasqueCountryDayTest.php +++ b/tests/Spain/BasqueCountry/BasqueCountryDayTest.php @@ -47,7 +47,7 @@ class BasqueCountryDayTest extends BasqueCountryBaseTestCase implements HolidayT */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ABOLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ABOLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -66,7 +66,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -77,7 +77,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testHolidayDayAfterAbolishment(): void { - $this->assertNotHoliday(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ABOLISHMENT_YEAR + 1)); + $this->assertNotHoliday(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ABOLISHMENT_YEAR + 1)); } /** @@ -90,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ABOLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ABOLISHMENT_YEAR), [self::LOCALE => 'Euskadi Eguna'] ); } @@ -105,7 +105,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ABOLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ABOLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/BasqueCountry/BasqueCountryTest.php b/tests/Spain/BasqueCountry/BasqueCountryTest.php index bd2b0adc0..78faad925 100644 --- a/tests/Spain/BasqueCountry/BasqueCountryTest.php +++ b/tests/Spain/BasqueCountry/BasqueCountryTest.php @@ -37,7 +37,7 @@ class BasqueCountryTest extends BasqueCountryBaseTestCase implements ProviderTes */ protected function setUp(): void { - $this->year = $this->generateRandomYear(2011, 2013); + $this->year = static::generateRandomYear(2011, 2013); } /** diff --git a/tests/Spain/CanaryIslands/CanaryIslandsDayTest.php b/tests/Spain/CanaryIslands/CanaryIslandsDayTest.php index 343fa4305..647309602 100644 --- a/tests/Spain/CanaryIslands/CanaryIslandsDayTest.php +++ b/tests/Spain/CanaryIslands/CanaryIslandsDayTest.php @@ -42,7 +42,7 @@ class CanaryIslandsDayTest extends CanaryIslandsBaseTestCase implements HolidayT */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de las Canarias'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/CanaryIslands/CanaryIslandsTest.php b/tests/Spain/CanaryIslands/CanaryIslandsTest.php index 95acd1531..0be6630ae 100644 --- a/tests/Spain/CanaryIslands/CanaryIslandsTest.php +++ b/tests/Spain/CanaryIslands/CanaryIslandsTest.php @@ -37,7 +37,7 @@ class CanaryIslandsTest extends CanaryIslandsBaseTestCase implements ProviderTes */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1984); + $this->year = static::generateRandomYear(1984); } /** diff --git a/tests/Spain/Cantabria/CantabriaDayTest.php b/tests/Spain/Cantabria/CantabriaDayTest.php index c6614aeb4..78d21c730 100644 --- a/tests/Spain/Cantabria/CantabriaDayTest.php +++ b/tests/Spain/Cantabria/CantabriaDayTest.php @@ -42,7 +42,7 @@ class CantabriaDayTest extends CantabriaBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de Cantabria'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/Cantabria/CantabriaTest.php b/tests/Spain/Cantabria/CantabriaTest.php index 5a81d1472..0f93c62e9 100644 --- a/tests/Spain/Cantabria/CantabriaTest.php +++ b/tests/Spain/Cantabria/CantabriaTest.php @@ -37,7 +37,7 @@ class CantabriaTest extends CantabriaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/CastileAndLeon/CastileAndLeonDayTest.php b/tests/Spain/CastileAndLeon/CastileAndLeonDayTest.php index 58164c39d..58aca932c 100644 --- a/tests/Spain/CastileAndLeon/CastileAndLeonDayTest.php +++ b/tests/Spain/CastileAndLeon/CastileAndLeonDayTest.php @@ -42,7 +42,7 @@ class CastileAndLeonDayTest extends CastileAndLeonBaseTestCase implements Holida */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de Castilla y León'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/CastileAndLeon/CastileAndLeonTest.php b/tests/Spain/CastileAndLeon/CastileAndLeonTest.php index 5d1da054c..4acb64e55 100644 --- a/tests/Spain/CastileAndLeon/CastileAndLeonTest.php +++ b/tests/Spain/CastileAndLeon/CastileAndLeonTest.php @@ -37,7 +37,7 @@ class CastileAndLeonTest extends CastileAndLeonBaseTestCase implements ProviderT */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/CastillaLaMancha/CastillaLaManchaDayTest.php b/tests/Spain/CastillaLaMancha/CastillaLaManchaDayTest.php index a41d9a0ee..3f3d4eaa2 100644 --- a/tests/Spain/CastillaLaMancha/CastillaLaManchaDayTest.php +++ b/tests/Spain/CastillaLaMancha/CastillaLaManchaDayTest.php @@ -42,7 +42,7 @@ class CastillaLaManchaDayTest extends CastillaLaManchaBaseTestCase implements Ho */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de la Región Castilla-La Mancha'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/CastillaLaMancha/CastillaLaManchaTest.php b/tests/Spain/CastillaLaMancha/CastillaLaManchaTest.php index 17b92310c..4b08d940a 100644 --- a/tests/Spain/CastillaLaMancha/CastillaLaManchaTest.php +++ b/tests/Spain/CastillaLaMancha/CastillaLaManchaTest.php @@ -37,7 +37,7 @@ class CastillaLaManchaTest extends CastillaLaManchaBaseTestCase implements Provi */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1984); + $this->year = static::generateRandomYear(1984); } /** diff --git a/tests/Spain/Catalonia/CataloniaTest.php b/tests/Spain/Catalonia/CataloniaTest.php index 1861594dd..58e126091 100644 --- a/tests/Spain/Catalonia/CataloniaTest.php +++ b/tests/Spain/Catalonia/CataloniaTest.php @@ -37,7 +37,7 @@ class CataloniaTest extends CataloniaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/Catalonia/nationalCataloniaDayTest.php b/tests/Spain/Catalonia/nationalCataloniaDayTest.php index 573aa9761..dc787feba 100644 --- a/tests/Spain/Catalonia/nationalCataloniaDayTest.php +++ b/tests/Spain/Catalonia/nationalCataloniaDayTest.php @@ -42,7 +42,7 @@ class nationalCataloniaDayTest extends CataloniaBaseTestCase implements HolidayT */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [ 'es' => 'Diada Nacional de Cataluña', 'ca' => 'Diada Nacional de Catalunya', @@ -93,7 +93,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/Catalonia/stJohnsDayTest.php b/tests/Spain/Catalonia/stJohnsDayTest.php index 29b364438..62dfd41f5 100644 --- a/tests/Spain/Catalonia/stJohnsDayTest.php +++ b/tests/Spain/Catalonia/stJohnsDayTest.php @@ -33,11 +33,10 @@ class stJohnsDayTest extends CataloniaBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(6, 24, self::TIMEZONE); + return static::generateRandomDates(6, 24, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Sant Joan'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Spain/Ceuta/CeutaTest.php b/tests/Spain/Ceuta/CeutaTest.php index 2f591d4e4..01598897f 100644 --- a/tests/Spain/Ceuta/CeutaTest.php +++ b/tests/Spain/Ceuta/CeutaTest.php @@ -37,7 +37,7 @@ class CeutaTest extends CeutaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/Ceuta/ceutaDayTest.php b/tests/Spain/Ceuta/ceutaDayTest.php index 759872f6c..f38baa957 100644 --- a/tests/Spain/Ceuta/ceutaDayTest.php +++ b/tests/Spain/Ceuta/ceutaDayTest.php @@ -42,7 +42,7 @@ class ceutaDayTest extends CeutaBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de Ceuta'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/ChristmasTest.php b/tests/Spain/ChristmasTest.php index 32066ca82..d3d95b9c4 100644 --- a/tests/Spain/ChristmasTest.php +++ b/tests/Spain/ChristmasTest.php @@ -33,11 +33,10 @@ class ChristmasTest extends SpainBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Navidad'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Spain/CommunityOfMadrid/CommunityOfMadridTest.php b/tests/Spain/CommunityOfMadrid/CommunityOfMadridTest.php index 7777decaa..ecc27265f 100644 --- a/tests/Spain/CommunityOfMadrid/CommunityOfMadridTest.php +++ b/tests/Spain/CommunityOfMadrid/CommunityOfMadridTest.php @@ -37,7 +37,7 @@ class CommunityOfMadridTest extends CommunityOfMadridBaseTestCase implements Pro */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/CommunityOfMadrid/DosdeMayoUprisingDayTest.php b/tests/Spain/CommunityOfMadrid/DosdeMayoUprisingDayTest.php index 298be2874..520e3e572 100644 --- a/tests/Spain/CommunityOfMadrid/DosdeMayoUprisingDayTest.php +++ b/tests/Spain/CommunityOfMadrid/DosdeMayoUprisingDayTest.php @@ -37,7 +37,7 @@ class DosdeMayoUprisingDayTest extends CommunityOfMadridBaseTestCase implements */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fiesta de la Comunidad de Madrid'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Spain/ConstitutionDayTest.php b/tests/Spain/ConstitutionDayTest.php index d35f5ba32..18836afe4 100644 --- a/tests/Spain/ConstitutionDayTest.php +++ b/tests/Spain/ConstitutionDayTest.php @@ -42,7 +42,7 @@ class ConstitutionDayTest extends SpainBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de la Constitución'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/EasterMondayTest.php b/tests/Spain/EasterMondayTest.php index 6ac7b8c7c..b787e48d1 100644 --- a/tests/Spain/EasterMondayTest.php +++ b/tests/Spain/EasterMondayTest.php @@ -62,7 +62,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lunes de Pascua'] ); } @@ -74,6 +74,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Spain/EpiphanyTest.php b/tests/Spain/EpiphanyTest.php index ab8f02d55..c75024883 100644 --- a/tests/Spain/EpiphanyTest.php +++ b/tests/Spain/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends SpainBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Día de Reyes'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Spain/Extremadura/ExtremaduraDayTest.php b/tests/Spain/Extremadura/ExtremaduraDayTest.php index c9dc8cecc..55e9c472c 100644 --- a/tests/Spain/Extremadura/ExtremaduraDayTest.php +++ b/tests/Spain/Extremadura/ExtremaduraDayTest.php @@ -42,7 +42,7 @@ class ExtremaduraDayTest extends ExtremaduraBaseTestCase implements HolidayTestC */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de Extremadura'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/Extremadura/ExtremaduraTest.php b/tests/Spain/Extremadura/ExtremaduraTest.php index afb6a223c..19d92c339 100644 --- a/tests/Spain/Extremadura/ExtremaduraTest.php +++ b/tests/Spain/Extremadura/ExtremaduraTest.php @@ -37,7 +37,7 @@ class ExtremaduraTest extends ExtremaduraBaseTestCase implements ProviderTestCas */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1984); + $this->year = static::generateRandomYear(1985); } /** diff --git a/tests/Spain/Galicia/GaliciaTest.php b/tests/Spain/Galicia/GaliciaTest.php index c0bb87ceb..52a237518 100644 --- a/tests/Spain/Galicia/GaliciaTest.php +++ b/tests/Spain/Galicia/GaliciaTest.php @@ -37,7 +37,7 @@ class GaliciaTest extends GaliciaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(2000); + $this->year = static::generateRandomYear(2000); } /** diff --git a/tests/Spain/Galicia/GalicianLiteratureDayTest.php b/tests/Spain/Galicia/GalicianLiteratureDayTest.php index 777bcd555..4d0217fd0 100644 --- a/tests/Spain/Galicia/GalicianLiteratureDayTest.php +++ b/tests/Spain/Galicia/GalicianLiteratureDayTest.php @@ -42,7 +42,7 @@ class GalicianLiteratureDayTest extends GaliciaBaseTestCase implements HolidayTe */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de las Letras Gallegas'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/Galicia/stJamesDayTest.php b/tests/Spain/Galicia/stJamesDayTest.php index ac1611f2b..67a179ec9 100644 --- a/tests/Spain/Galicia/stJamesDayTest.php +++ b/tests/Spain/Galicia/stJamesDayTest.php @@ -42,7 +42,7 @@ class stJamesDayTest extends GaliciaBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Santiago Apostol'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/GoodFridayTest.php b/tests/Spain/GoodFridayTest.php index 412ef2078..f0cd1c83c 100644 --- a/tests/Spain/GoodFridayTest.php +++ b/tests/Spain/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Viernes Santo'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Spain/ImmaculateConceptionTest.php b/tests/Spain/ImmaculateConceptionTest.php index 02ad08e21..cef91a431 100644 --- a/tests/Spain/ImmaculateConceptionTest.php +++ b/tests/Spain/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends SpainBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Inmaculada Concepción'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Spain/InternationalWorkersDayTest.php b/tests/Spain/InternationalWorkersDayTest.php index 381546796..69ca4aa13 100644 --- a/tests/Spain/InternationalWorkersDayTest.php +++ b/tests/Spain/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends SpainBaseTestCase implements HolidayTe /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Día del Trabajador'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Spain/LaRioja/LaRiojaDayTest.php b/tests/Spain/LaRioja/LaRiojaDayTest.php index 941d59dd0..e3cb38c83 100644 --- a/tests/Spain/LaRioja/LaRiojaDayTest.php +++ b/tests/Spain/LaRioja/LaRiojaDayTest.php @@ -42,7 +42,7 @@ class LaRiojaDayTest extends LaRiojaBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de La Rioja'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/LaRioja/LaRiojaTest.php b/tests/Spain/LaRioja/LaRiojaTest.php index 438aa08e9..357860fdf 100644 --- a/tests/Spain/LaRioja/LaRiojaTest.php +++ b/tests/Spain/LaRioja/LaRiojaTest.php @@ -37,7 +37,7 @@ class LaRiojaTest extends LaRiojaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1983); + $this->year = static::generateRandomYear(1983); } /** diff --git a/tests/Spain/MaundyThursdayTest.php b/tests/Spain/MaundyThursdayTest.php index e87a078d5..4be064822 100644 --- a/tests/Spain/MaundyThursdayTest.php +++ b/tests/Spain/MaundyThursdayTest.php @@ -62,7 +62,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Jueves Santo'] ); } @@ -74,6 +74,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Spain/Melilla/MelillaTest.php b/tests/Spain/Melilla/MelillaTest.php index 2df6f290a..3261bf19b 100644 --- a/tests/Spain/Melilla/MelillaTest.php +++ b/tests/Spain/Melilla/MelillaTest.php @@ -37,7 +37,7 @@ class MelillaTest extends MelillaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/NationalDayTest.php b/tests/Spain/NationalDayTest.php index 8ff256561..8cfe8b244 100644 --- a/tests/Spain/NationalDayTest.php +++ b/tests/Spain/NationalDayTest.php @@ -42,7 +42,7 @@ class NationalDayTest extends SpainBaseTestCase implements HolidayTestCase */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Fiesta Nacional de España'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/Navarre/NavarreTest.php b/tests/Spain/Navarre/NavarreTest.php index 27a432177..72c34cb50 100644 --- a/tests/Spain/Navarre/NavarreTest.php +++ b/tests/Spain/Navarre/NavarreTest.php @@ -37,7 +37,7 @@ class NavarreTest extends NavarreBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/NewYearsDayTest.php b/tests/Spain/NewYearsDayTest.php index dd976ffc4..981c58dff 100644 --- a/tests/Spain/NewYearsDayTest.php +++ b/tests/Spain/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends SpainBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Año Nuevo'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Spain/RegionOfMurcia/RegionOfMurciaDayTest.php b/tests/Spain/RegionOfMurcia/RegionOfMurciaDayTest.php index 1d3e96a7c..a2eb20b42 100644 --- a/tests/Spain/RegionOfMurcia/RegionOfMurciaDayTest.php +++ b/tests/Spain/RegionOfMurcia/RegionOfMurciaDayTest.php @@ -42,7 +42,7 @@ class RegionOfMurciaDayTest extends RegionOfMurciaBaseTestCase implements Holida */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de la Región de Murcia'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/RegionOfMurcia/RegionOfMurciaTest.php b/tests/Spain/RegionOfMurcia/RegionOfMurciaTest.php index 4aca1adad..50be527f8 100644 --- a/tests/Spain/RegionOfMurcia/RegionOfMurciaTest.php +++ b/tests/Spain/RegionOfMurcia/RegionOfMurciaTest.php @@ -37,7 +37,7 @@ class RegionOfMurciaTest extends RegionOfMurciaBaseTestCase implements ProviderT */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1983); } /** diff --git a/tests/Spain/SpainTest.php b/tests/Spain/SpainTest.php index 138ac58ba..95aa25aae 100644 --- a/tests/Spain/SpainTest.php +++ b/tests/Spain/SpainTest.php @@ -37,7 +37,7 @@ class SpainTest extends SpainBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(2000); + $this->year = static::generateRandomYear(2000); } /** diff --git a/tests/Spain/ValencianCommunity/ValencianCommunityDayTest.php b/tests/Spain/ValencianCommunity/ValencianCommunityDayTest.php index 2ccd1979c..6e75fcb43 100644 --- a/tests/Spain/ValencianCommunity/ValencianCommunityDayTest.php +++ b/tests/Spain/ValencianCommunity/ValencianCommunityDayTest.php @@ -42,7 +42,7 @@ class ValencianCommunityDayTest extends ValencianCommunityBaseTestCase implement */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Día de la Comunidad Valenciana'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Spain/ValencianCommunity/ValencianCommunityTest.php b/tests/Spain/ValencianCommunity/ValencianCommunityTest.php index 250eed204..b33d6490a 100644 --- a/tests/Spain/ValencianCommunity/ValencianCommunityTest.php +++ b/tests/Spain/ValencianCommunity/ValencianCommunityTest.php @@ -37,7 +37,7 @@ class ValencianCommunityTest extends ValencianCommunityBaseTestCase implements P */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1981); + $this->year = static::generateRandomYear(1981); } /** diff --git a/tests/Spain/ValentinesDayTest.php b/tests/Spain/ValentinesDayTest.php index f8f62e1ce..d7fb68b52 100644 --- a/tests/Spain/ValentinesDayTest.php +++ b/tests/Spain/ValentinesDayTest.php @@ -33,11 +33,10 @@ class ValentinesDayTest extends SpainBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(2, 14, self::TIMEZONE); + return static::generateRandomDates(2, 14, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'San Valentín'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Spain/stJosephsDayTest.php b/tests/Spain/stJosephsDayTest.php index c9486facf..1fa7d635d 100644 --- a/tests/Spain/stJosephsDayTest.php +++ b/tests/Spain/stJosephsDayTest.php @@ -39,11 +39,10 @@ class stJosephsDayTest extends SpainBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -56,9 +55,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(3, 19, self::TIMEZONE); + return static::generateRandomDates(3, 19, self::TIMEZONE); } /** @@ -71,7 +70,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'San José'] ); } @@ -83,6 +82,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Sweden/AllSaintsDayTest.php b/tests/Sweden/AllSaintsDayTest.php index 20a953d3e..1e78af8f6 100644 --- a/tests/Sweden/AllSaintsDayTest.php +++ b/tests/Sweden/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends SwedenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,12 +49,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-10-31", new \DateTimeZone(self::TIMEZONE)); // Check between 31 October and 6th of November the day that is a Saturday @@ -81,7 +80,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'alla helgons dag'] ); } @@ -93,6 +92,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/AllSaintsEveTest.php b/tests/Sweden/AllSaintsEveTest.php index 0e39d43f6..8c7b571d9 100644 --- a/tests/Sweden/AllSaintsEveTest.php +++ b/tests/Sweden/AllSaintsEveTest.php @@ -33,11 +33,10 @@ class AllSaintsEveTest extends SwedenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,12 +49,12 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-10-30", new \DateTimeZone(self::TIMEZONE)); // Check between 30 October and 5th of November the day that is a Friday @@ -81,7 +80,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'alla helgons afton'] ); } @@ -93,6 +92,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Sweden/AscensionDayTest.php b/tests/Sweden/AscensionDayTest.php index 73a3e2ab9..6c5c5d44d 100644 --- a/tests/Sweden/AscensionDayTest.php +++ b/tests/Sweden/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Kristi himmelsfärdsdag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/ChristmasDayTest.php b/tests/Sweden/ChristmasDayTest.php index 34260c4bb..e9e531c3e 100644 --- a/tests/Sweden/ChristmasDayTest.php +++ b/tests/Sweden/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends SwedenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'juldagen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/ChristmasEveTest.php b/tests/Sweden/ChristmasEveTest.php index 7f482ac9a..9d38a469f 100644 --- a/tests/Sweden/ChristmasEveTest.php +++ b/tests/Sweden/ChristmasEveTest.php @@ -33,11 +33,10 @@ class ChristmasEveTest extends SwedenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 24, self::TIMEZONE); + return static::generateRandomDates(12, 24, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'julafton'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Sweden/EasterMondayTest.php b/tests/Sweden/EasterMondayTest.php index 6f83ae143..4bbe84030 100644 --- a/tests/Sweden/EasterMondayTest.php +++ b/tests/Sweden/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'annandag påsk'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/EasterTest.php b/tests/Sweden/EasterTest.php index 672536c38..0772dd902 100644 --- a/tests/Sweden/EasterTest.php +++ b/tests/Sweden/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'påskdagen'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/EpiphanyEveTest.php b/tests/Sweden/EpiphanyEveTest.php index b176aa514..c72be25e3 100644 --- a/tests/Sweden/EpiphanyEveTest.php +++ b/tests/Sweden/EpiphanyEveTest.php @@ -33,11 +33,10 @@ class EpiphanyEveTest extends SwedenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 5, self::TIMEZONE); + return static::generateRandomDates(1, 5, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'trettondagsafton'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Sweden/EpiphanyTest.php b/tests/Sweden/EpiphanyTest.php index a5aa324b4..4cce84f13 100644 --- a/tests/Sweden/EpiphanyTest.php +++ b/tests/Sweden/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends SwedenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'trettondedag jul'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/GoodFridayTest.php b/tests/Sweden/GoodFridayTest.php index 3bdb55436..9e74a8441 100644 --- a/tests/Sweden/GoodFridayTest.php +++ b/tests/Sweden/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'långfredagen'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/InternationalWorkersDayTest.php b/tests/Sweden/InternationalWorkersDayTest.php index 5ee530f13..2c8951b39 100644 --- a/tests/Sweden/InternationalWorkersDayTest.php +++ b/tests/Sweden/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends SwedenBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'första maj'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Sweden/NationalDayTest.php b/tests/Sweden/NationalDayTest.php index deee76237..14b8ca95d 100644 --- a/tests/Sweden/NationalDayTest.php +++ b/tests/Sweden/NationalDayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1982), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1982), [self::LOCALE => 'Svenska flaggans dag'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } @@ -105,7 +105,7 @@ public function testTranslationOnAfterNameChange(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1983), + static::generateRandomYear(1983), [self::LOCALE => 'Sveriges nationaldag'] ); } diff --git a/tests/Sweden/NewYearsDayTest.php b/tests/Sweden/NewYearsDayTest.php index cacb086af..a2561ac02 100644 --- a/tests/Sweden/NewYearsDayTest.php +++ b/tests/Sweden/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends SwedenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'nyårsdagen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/NewYearsEveTest.php b/tests/Sweden/NewYearsEveTest.php index e68f40f65..eee880798 100644 --- a/tests/Sweden/NewYearsEveTest.php +++ b/tests/Sweden/NewYearsEveTest.php @@ -33,11 +33,10 @@ class NewYearsEveTest extends SwedenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 31, self::TIMEZONE); + return static::generateRandomDates(12, 31, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'nyårsafton'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Sweden/PentecostTest.php b/tests/Sweden/PentecostTest.php index c678c0c48..3360df4ae 100644 --- a/tests/Sweden/PentecostTest.php +++ b/tests/Sweden/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'pingstdagen'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/SecondChristmasDayTest.php b/tests/Sweden/SecondChristmasDayTest.php index f758ece0f..7ae9ca5bf 100644 --- a/tests/Sweden/SecondChristmasDayTest.php +++ b/tests/Sweden/SecondChristmasDayTest.php @@ -33,11 +33,10 @@ class SecondChristmasDayTest extends SwedenBaseTestCase implements HolidayTestCa /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'annandag jul'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/StJohnsDayTest.php b/tests/Sweden/StJohnsDayTest.php index 29105aef1..7ac8f16d0 100644 --- a/tests/Sweden/StJohnsDayTest.php +++ b/tests/Sweden/StJohnsDayTest.php @@ -38,14 +38,13 @@ class StJohnsDayTest extends SwedenBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $holidays = Yasumi::create(self::REGION, $year); $holiday = $holidays->getHoliday(self::HOLIDAY); // Some basic assertions self::assertInstanceOf(Holiday::class, $holiday); - self::assertNotNull($holiday); // Holiday specific assertions self::assertEquals('Saturday', $holiday->format('l')); @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'midsommardagen'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Sweden/StJohnsEveTest.php b/tests/Sweden/StJohnsEveTest.php index 078d798f6..452dbf9b8 100644 --- a/tests/Sweden/StJohnsEveTest.php +++ b/tests/Sweden/StJohnsEveTest.php @@ -38,14 +38,13 @@ class StJohnsEveTest extends SwedenBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $holidays = Yasumi::create(self::REGION, $year); $holiday = $holidays->getHoliday(self::HOLIDAY); // Some basic assertions self::assertInstanceOf(Holiday::class, $holiday); - self::assertNotNull($holiday); // Holiday specific assertions self::assertEquals('Friday', $holiday->format('l')); @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'midsommarafton'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Sweden/SwedenTest.php b/tests/Sweden/SwedenTest.php index f65bb7131..89ea1a41b 100644 --- a/tests/Sweden/SwedenTest.php +++ b/tests/Sweden/SwedenTest.php @@ -37,7 +37,7 @@ class SwedenTest extends SwedenBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1916); + $this->year = static::generateRandomYear(1916); } /** diff --git a/tests/Sweden/WalpurgisEveTest.php b/tests/Sweden/WalpurgisEveTest.php index 5d77696a1..9bdeabf59 100644 --- a/tests/Sweden/WalpurgisEveTest.php +++ b/tests/Sweden/WalpurgisEveTest.php @@ -33,11 +33,10 @@ class WalpurgisEveTest extends SwedenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(4, 30, self::TIMEZONE); + return static::generateRandomDates(4, 30, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'valborgsmässoafton'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OBSERVANCE); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OBSERVANCE); } } diff --git a/tests/Switzerland/Aargau/AargauTest.php b/tests/Switzerland/Aargau/AargauTest.php index 4d0aa37b9..112474547 100644 --- a/tests/Switzerland/Aargau/AargauTest.php +++ b/tests/Switzerland/Aargau/AargauTest.php @@ -37,7 +37,7 @@ class AargauTest extends AargauBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -99,7 +99,17 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'goodFriday', + 'ascensionDay', + 'christmasDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Aargau/AscensionDayTest.php b/tests/Switzerland/Aargau/AscensionDayTest.php index a50fa2dfa..346cbd1c3 100644 --- a/tests/Switzerland/Aargau/AscensionDayTest.php +++ b/tests/Switzerland/Aargau/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Aargau/ChristmasDayTest.php b/tests/Switzerland/Aargau/ChristmasDayTest.php index 7cb3143f2..9aeca4d90 100644 --- a/tests/Switzerland/Aargau/ChristmasDayTest.php +++ b/tests/Switzerland/Aargau/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends AargauBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Aargau/GoodFridayTest.php b/tests/Switzerland/Aargau/GoodFridayTest.php index 6253c1094..ecb67a7b9 100644 --- a/tests/Switzerland/Aargau/GoodFridayTest.php +++ b/tests/Switzerland/Aargau/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Aargau/NewYearsDayTest.php b/tests/Switzerland/Aargau/NewYearsDayTest.php index a965cbc13..8f13009b2 100644 --- a/tests/Switzerland/Aargau/NewYearsDayTest.php +++ b/tests/Switzerland/Aargau/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends AargauBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenTest.php b/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenTest.php index 93ff9b2ca..a28813631 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/AppenzellAusserrhodenTest.php @@ -37,7 +37,7 @@ class AppenzellAusserrhodenTest extends AppenzellAusserrhodenBaseTestCase implem */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -102,7 +102,20 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/AppenzellAusserrhoden/AscensionDayTest.php b/tests/Switzerland/AppenzellAusserrhoden/AscensionDayTest.php index 22a94627a..e91534b35 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/AscensionDayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellAusserrhoden/ChristmasDayTest.php b/tests/Switzerland/AppenzellAusserrhoden/ChristmasDayTest.php index 9a99af2c4..9144cd269 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/ChristmasDayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends AppenzellAusserrhodenBaseTestCase implements Holi /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellAusserrhoden/EasterMondayTest.php b/tests/Switzerland/AppenzellAusserrhoden/EasterMondayTest.php index 0f917abca..430110d29 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/EasterMondayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellAusserrhoden/GoodFridayTest.php b/tests/Switzerland/AppenzellAusserrhoden/GoodFridayTest.php index 97356ff5b..3d635e2fc 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/GoodFridayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellAusserrhoden/NewYearsDayTest.php b/tests/Switzerland/AppenzellAusserrhoden/NewYearsDayTest.php index df4461d5c..9ced14de4 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/NewYearsDayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends AppenzellAusserrhodenBaseTestCase implements Holid /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/AppenzellAusserrhoden/PentecostMondayTest.php b/tests/Switzerland/AppenzellAusserrhoden/PentecostMondayTest.php index cdb38081f..049087da8 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/PentecostMondayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellAusserrhoden/StStephensDayTest.php b/tests/Switzerland/AppenzellAusserrhoden/StStephensDayTest.php index 98a90e880..870bf6ccb 100644 --- a/tests/Switzerland/AppenzellAusserrhoden/StStephensDayTest.php +++ b/tests/Switzerland/AppenzellAusserrhoden/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends AppenzellAusserrhodenBaseTestCase implements Hol /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/AllSaintsDayTest.php b/tests/Switzerland/AppenzellInnerrhoden/AllSaintsDayTest.php index 47cc54a26..27e631e00 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/AllSaintsDayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends AppenzellInnerrhodenBaseTestCase implements Holid /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenTest.php b/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenTest.php index 0afcec61a..0bba64d83 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/AppenzellInnerrhodenTest.php @@ -37,7 +37,7 @@ class AppenzellInnerrhodenTest extends AppenzellInnerrhodenBaseTestCase implemen */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -106,7 +106,24 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'corpusChristi', + 'assumptionOfMary', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/AppenzellInnerrhoden/AscensionDayTest.php b/tests/Switzerland/AppenzellInnerrhoden/AscensionDayTest.php index da0afc714..17baf69f9 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/AscensionDayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/AssumptionOfMaryTest.php b/tests/Switzerland/AppenzellInnerrhoden/AssumptionOfMaryTest.php index e562b67f6..aefba491b 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/AssumptionOfMaryTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends AppenzellInnerrhodenBaseTestCase implements H /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Himmelfahrt'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/ChristmasDayTest.php b/tests/Switzerland/AppenzellInnerrhoden/ChristmasDayTest.php index 21052c7b8..bc56c35f8 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/ChristmasDayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends AppenzellInnerrhodenBaseTestCase implements Holid /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/CorpusChristiTest.php b/tests/Switzerland/AppenzellInnerrhoden/CorpusChristiTest.php index 9a73a91ea..89290d205 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/CorpusChristiTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/EasterMondayTest.php b/tests/Switzerland/AppenzellInnerrhoden/EasterMondayTest.php index ceca4b99a..cafa46df1 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/EasterMondayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/GoodFridayTest.php b/tests/Switzerland/AppenzellInnerrhoden/GoodFridayTest.php index b3b3e2f2d..9aaeb96a6 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/GoodFridayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/ImmaculateConceptionTest.php b/tests/Switzerland/AppenzellInnerrhoden/ImmaculateConceptionTest.php index d9503d306..2f49bb43c 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/ImmaculateConceptionTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends AppenzellInnerrhodenBaseTestCase implemen /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Empfängnis'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/NewYearsDayTest.php b/tests/Switzerland/AppenzellInnerrhoden/NewYearsDayTest.php index a2656b600..25ca12d26 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/NewYearsDayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends AppenzellInnerrhodenBaseTestCase implements Holida /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/PentecostMondayTest.php b/tests/Switzerland/AppenzellInnerrhoden/PentecostMondayTest.php index 3205f7872..bffa47487 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/PentecostMondayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/AppenzellInnerrhoden/StStephensDayTest.php b/tests/Switzerland/AppenzellInnerrhoden/StStephensDayTest.php index 24846838c..a30553698 100644 --- a/tests/Switzerland/AppenzellInnerrhoden/StStephensDayTest.php +++ b/tests/Switzerland/AppenzellInnerrhoden/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends AppenzellInnerrhodenBaseTestCase implements Holi /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselLandschaft/AscensionDayTest.php b/tests/Switzerland/BaselLandschaft/AscensionDayTest.php index 6629d648c..65e680924 100644 --- a/tests/Switzerland/BaselLandschaft/AscensionDayTest.php +++ b/tests/Switzerland/BaselLandschaft/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselLandschaft/BaselLandschaftTest.php b/tests/Switzerland/BaselLandschaft/BaselLandschaftTest.php index 8427b6a0d..69865626d 100644 --- a/tests/Switzerland/BaselLandschaft/BaselLandschaftTest.php +++ b/tests/Switzerland/BaselLandschaft/BaselLandschaftTest.php @@ -37,7 +37,7 @@ class BaselLandschaftTest extends BaselLandschaftBaseTestCase implements Provide */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -103,7 +103,21 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'internationalWorkersDay', + 'ascensionDay', + 'pentecostMonday', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/BaselLandschaft/ChristmasDayTest.php b/tests/Switzerland/BaselLandschaft/ChristmasDayTest.php index 4fa03a888..439a3c0e3 100644 --- a/tests/Switzerland/BaselLandschaft/ChristmasDayTest.php +++ b/tests/Switzerland/BaselLandschaft/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends BaselLandschaftBaseTestCase implements HolidayTes /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselLandschaft/EasterMondayTest.php b/tests/Switzerland/BaselLandschaft/EasterMondayTest.php index 6a22041ad..fac17c0b3 100644 --- a/tests/Switzerland/BaselLandschaft/EasterMondayTest.php +++ b/tests/Switzerland/BaselLandschaft/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselLandschaft/GoodFridayTest.php b/tests/Switzerland/BaselLandschaft/GoodFridayTest.php index 512dc1f40..366d3258f 100644 --- a/tests/Switzerland/BaselLandschaft/GoodFridayTest.php +++ b/tests/Switzerland/BaselLandschaft/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselLandschaft/NewYearsDayTest.php b/tests/Switzerland/BaselLandschaft/NewYearsDayTest.php index 79661e15b..1c4feddbb 100644 --- a/tests/Switzerland/BaselLandschaft/NewYearsDayTest.php +++ b/tests/Switzerland/BaselLandschaft/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends BaselLandschaftBaseTestCase implements HolidayTest /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/BaselLandschaft/PentecostMondayTest.php b/tests/Switzerland/BaselLandschaft/PentecostMondayTest.php index 1fa7554ce..0962317a7 100644 --- a/tests/Switzerland/BaselLandschaft/PentecostMondayTest.php +++ b/tests/Switzerland/BaselLandschaft/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselLandschaft/StStephensDayTest.php b/tests/Switzerland/BaselLandschaft/StStephensDayTest.php index 25b46bb06..4decd4f22 100644 --- a/tests/Switzerland/BaselLandschaft/StStephensDayTest.php +++ b/tests/Switzerland/BaselLandschaft/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends BaselLandschaftBaseTestCase implements HolidayTe /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselLandschaft/WorkersDayTest.php b/tests/Switzerland/BaselLandschaft/WorkersDayTest.php index 25c39aa44..9a0483faf 100644 --- a/tests/Switzerland/BaselLandschaft/WorkersDayTest.php +++ b/tests/Switzerland/BaselLandschaft/WorkersDayTest.php @@ -33,13 +33,12 @@ class WorkersDayTest extends BaselLandschaftBaseTestCase implements HolidayTestC /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -53,12 +52,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-5-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -76,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Tag der Arbeit'] ); } @@ -88,6 +87,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselStadt/AscensionDayTest.php b/tests/Switzerland/BaselStadt/AscensionDayTest.php index b2a7f5183..dde38535e 100644 --- a/tests/Switzerland/BaselStadt/AscensionDayTest.php +++ b/tests/Switzerland/BaselStadt/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselStadt/BaselStadtTest.php b/tests/Switzerland/BaselStadt/BaselStadtTest.php index 4784b004b..1cdf10930 100644 --- a/tests/Switzerland/BaselStadt/BaselStadtTest.php +++ b/tests/Switzerland/BaselStadt/BaselStadtTest.php @@ -37,7 +37,7 @@ class BaselStadtTest extends BaselStadtBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -103,7 +103,21 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'internationalWorkersDay', + 'ascensionDay', + 'pentecostMonday', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/BaselStadt/ChristmasDayTest.php b/tests/Switzerland/BaselStadt/ChristmasDayTest.php index 4fdabcec5..890c8c8dc 100644 --- a/tests/Switzerland/BaselStadt/ChristmasDayTest.php +++ b/tests/Switzerland/BaselStadt/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends BaselStadtBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselStadt/EasterMondayTest.php b/tests/Switzerland/BaselStadt/EasterMondayTest.php index e8d9b1ac3..8ffc4fbc8 100644 --- a/tests/Switzerland/BaselStadt/EasterMondayTest.php +++ b/tests/Switzerland/BaselStadt/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselStadt/GoodFridayTest.php b/tests/Switzerland/BaselStadt/GoodFridayTest.php index e662de553..71b884b3c 100644 --- a/tests/Switzerland/BaselStadt/GoodFridayTest.php +++ b/tests/Switzerland/BaselStadt/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselStadt/NewYearsDayTest.php b/tests/Switzerland/BaselStadt/NewYearsDayTest.php index 88aa27f41..bcee90355 100644 --- a/tests/Switzerland/BaselStadt/NewYearsDayTest.php +++ b/tests/Switzerland/BaselStadt/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends BaselStadtBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/BaselStadt/PentecostMondayTest.php b/tests/Switzerland/BaselStadt/PentecostMondayTest.php index 004f4413e..6fc7fe14d 100644 --- a/tests/Switzerland/BaselStadt/PentecostMondayTest.php +++ b/tests/Switzerland/BaselStadt/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselStadt/StStephensDayTest.php b/tests/Switzerland/BaselStadt/StStephensDayTest.php index 80da9d698..38c5678b3 100644 --- a/tests/Switzerland/BaselStadt/StStephensDayTest.php +++ b/tests/Switzerland/BaselStadt/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends BaselStadtBaseTestCase implements HolidayTestCas /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/BaselStadt/WorkersDayTest.php b/tests/Switzerland/BaselStadt/WorkersDayTest.php index b2d57fcab..27c1f2bcf 100644 --- a/tests/Switzerland/BaselStadt/WorkersDayTest.php +++ b/tests/Switzerland/BaselStadt/WorkersDayTest.php @@ -33,13 +33,12 @@ class WorkersDayTest extends BaselStadtBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -53,12 +52,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-5-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -76,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Tag der Arbeit'] ); } @@ -88,6 +87,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Bern/AscensionDayTest.php b/tests/Switzerland/Bern/AscensionDayTest.php index d2d079d59..709fe4fc7 100644 --- a/tests/Switzerland/Bern/AscensionDayTest.php +++ b/tests/Switzerland/Bern/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Bern/BerchtoldsTagTest.php b/tests/Switzerland/Bern/BerchtoldsTagTest.php index 00f0eda65..1a2338ce0 100644 --- a/tests/Switzerland/Bern/BerchtoldsTagTest.php +++ b/tests/Switzerland/Bern/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends BernBaseTestCase implements HolidayTestCase */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Berchtoldstag'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Bern/BernTest.php b/tests/Switzerland/Bern/BernTest.php index fa2146930..919f458ad 100644 --- a/tests/Switzerland/Bern/BernTest.php +++ b/tests/Switzerland/Bern/BernTest.php @@ -37,7 +37,7 @@ class BernTest extends BernBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -103,7 +103,21 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Bern/ChristmasDayTest.php b/tests/Switzerland/Bern/ChristmasDayTest.php index a9359ffc8..bf66e8bbb 100644 --- a/tests/Switzerland/Bern/ChristmasDayTest.php +++ b/tests/Switzerland/Bern/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends BernBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Bern/EasterMondayTest.php b/tests/Switzerland/Bern/EasterMondayTest.php index b3835108c..4f78a864a 100644 --- a/tests/Switzerland/Bern/EasterMondayTest.php +++ b/tests/Switzerland/Bern/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Bern/GoodFridayTest.php b/tests/Switzerland/Bern/GoodFridayTest.php index 86c12aca4..c2aa8f2dd 100644 --- a/tests/Switzerland/Bern/GoodFridayTest.php +++ b/tests/Switzerland/Bern/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Bern/NewYearsDayTest.php b/tests/Switzerland/Bern/NewYearsDayTest.php index 86b224272..f9e032c7e 100644 --- a/tests/Switzerland/Bern/NewYearsDayTest.php +++ b/tests/Switzerland/Bern/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends BernBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Bern/PentecostMondayTest.php b/tests/Switzerland/Bern/PentecostMondayTest.php index 06725f531..4fd2f75d8 100644 --- a/tests/Switzerland/Bern/PentecostMondayTest.php +++ b/tests/Switzerland/Bern/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Bern/StStephensDayTest.php b/tests/Switzerland/Bern/StStephensDayTest.php index 947addc3a..4ab6c3454 100644 --- a/tests/Switzerland/Bern/StStephensDayTest.php +++ b/tests/Switzerland/Bern/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends BernBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Fribourg/AllSaintsDayTest.php b/tests/Switzerland/Fribourg/AllSaintsDayTest.php index c48862649..b714fc497 100644 --- a/tests/Switzerland/Fribourg/AllSaintsDayTest.php +++ b/tests/Switzerland/Fribourg/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends FribourgBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Toussaint'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Fribourg/AscensionDayTest.php b/tests/Switzerland/Fribourg/AscensionDayTest.php index ee2e4484e..505d26a10 100644 --- a/tests/Switzerland/Fribourg/AscensionDayTest.php +++ b/tests/Switzerland/Fribourg/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ascension'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Fribourg/AssumptionOfMaryTest.php b/tests/Switzerland/Fribourg/AssumptionOfMaryTest.php index 01f945771..63a8aec15 100644 --- a/tests/Switzerland/Fribourg/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Fribourg/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends FribourgBaseTestCase implements HolidayTestCa /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Assomption'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/Fribourg/BerchtoldsTagTest.php b/tests/Switzerland/Fribourg/BerchtoldsTagTest.php index 0b42eb76c..88a90874f 100644 --- a/tests/Switzerland/Fribourg/BerchtoldsTagTest.php +++ b/tests/Switzerland/Fribourg/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends FribourgBaseTestCase implements HolidayTestCase */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Jour de la Saint-Berthold'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Fribourg/ChristmasDayTest.php b/tests/Switzerland/Fribourg/ChristmasDayTest.php index 7aceb7221..cb8a3ee55 100644 --- a/tests/Switzerland/Fribourg/ChristmasDayTest.php +++ b/tests/Switzerland/Fribourg/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends FribourgBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Noël'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Fribourg/CorpusChristiTest.php b/tests/Switzerland/Fribourg/CorpusChristiTest.php index 23978581f..dc1ce015a 100644 --- a/tests/Switzerland/Fribourg/CorpusChristiTest.php +++ b/tests/Switzerland/Fribourg/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fête-Dieu'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Fribourg/December26thTest.php b/tests/Switzerland/Fribourg/December26thTest.php index 1fc7789ac..bb1d655bb 100644 --- a/tests/Switzerland/Fribourg/December26thTest.php +++ b/tests/Switzerland/Fribourg/December26thTest.php @@ -37,7 +37,7 @@ class December26thTest extends FribourgBaseTestCase implements HolidayTestCase */ public function testDecember26th(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => '26 décembre'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Fribourg/EasterMondayTest.php b/tests/Switzerland/Fribourg/EasterMondayTest.php index 5bfc462cf..17728dd12 100644 --- a/tests/Switzerland/Fribourg/EasterMondayTest.php +++ b/tests/Switzerland/Fribourg/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pâques'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Fribourg/FribourgTest.php b/tests/Switzerland/Fribourg/FribourgTest.php index 9b7e90435..66fc345cb 100644 --- a/tests/Switzerland/Fribourg/FribourgTest.php +++ b/tests/Switzerland/Fribourg/FribourgTest.php @@ -37,7 +37,7 @@ class FribourgTest extends FribourgBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -107,7 +107,25 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'corpusChristi', + 'assumptionOfMary', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + 'december26th', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Fribourg/GoodFridayTest.php b/tests/Switzerland/Fribourg/GoodFridayTest.php index 4599ead84..682643a99 100644 --- a/tests/Switzerland/Fribourg/GoodFridayTest.php +++ b/tests/Switzerland/Fribourg/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vendredi Saint'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Fribourg/ImmaculateConceptionTest.php b/tests/Switzerland/Fribourg/ImmaculateConceptionTest.php index d84853ede..a7f317790 100644 --- a/tests/Switzerland/Fribourg/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Fribourg/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends FribourgBaseTestCase implements HolidayTe /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Immaculée Conception'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Fribourg/NewYearsDayTest.php b/tests/Switzerland/Fribourg/NewYearsDayTest.php index 15bc129c2..faa9526a6 100644 --- a/tests/Switzerland/Fribourg/NewYearsDayTest.php +++ b/tests/Switzerland/Fribourg/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends FribourgBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nouvel An'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Fribourg/PentecostMondayTest.php b/tests/Switzerland/Fribourg/PentecostMondayTest.php index 2d141cc7d..f2484da06 100644 --- a/tests/Switzerland/Fribourg/PentecostMondayTest.php +++ b/tests/Switzerland/Fribourg/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pentecôte'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Geneva/AscensionDayTest.php b/tests/Switzerland/Geneva/AscensionDayTest.php index 6858c1080..011c3ae38 100644 --- a/tests/Switzerland/Geneva/AscensionDayTest.php +++ b/tests/Switzerland/Geneva/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ascension'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Geneva/ChristmasDayTest.php b/tests/Switzerland/Geneva/ChristmasDayTest.php index 96c3315f7..20aa8d8b4 100644 --- a/tests/Switzerland/Geneva/ChristmasDayTest.php +++ b/tests/Switzerland/Geneva/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends GenevaBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Noël'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Geneva/EasterMondayTest.php b/tests/Switzerland/Geneva/EasterMondayTest.php index a61f483c5..4d98c0f15 100644 --- a/tests/Switzerland/Geneva/EasterMondayTest.php +++ b/tests/Switzerland/Geneva/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pâques'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Geneva/GenevaTest.php b/tests/Switzerland/Geneva/GenevaTest.php index df632e0a2..45af127f2 100644 --- a/tests/Switzerland/Geneva/GenevaTest.php +++ b/tests/Switzerland/Geneva/GenevaTest.php @@ -37,7 +37,7 @@ class GenevaTest extends GenevaBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** diff --git a/tests/Switzerland/Geneva/GoodFridayTest.php b/tests/Switzerland/Geneva/GoodFridayTest.php index 550be64a9..0cb2584ae 100644 --- a/tests/Switzerland/Geneva/GoodFridayTest.php +++ b/tests/Switzerland/Geneva/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vendredi Saint'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Geneva/JeuneGenevoisTest.php b/tests/Switzerland/Geneva/JeuneGenevoisTest.php index cc5869801..cf94fe5ae 100644 --- a/tests/Switzerland/Geneva/JeuneGenevoisTest.php +++ b/tests/Switzerland/Geneva/JeuneGenevoisTest.php @@ -38,7 +38,7 @@ class JeuneGenevoisTest extends GenevaBaseTestCase implements HolidayTestCase */ public function testJeuneGenevoisBetween1870And1965(): void { - $year = $this->generateRandomYear(1870, 1965); + $year = static::generateRandomYear(1870, 1965); // Find first Sunday of September $date = new \DateTime('First Sunday of ' . $year . '-09', new \DateTimeZone(self::TIMEZONE)); // Go to next Thursday @@ -55,7 +55,7 @@ public function testJeuneGenevoisBetween1870And1965(): void */ public function testJeuneGenevoisBetween1840And1869(): void { - $year = $this->generateRandomYear(Geneva::JEUNE_GENEVOIS_ESTABLISHMENT_YEAR, 1869); + $year = static::generateRandomYear(Geneva::JEUNE_GENEVOIS_ESTABLISHMENT_YEAR, 1869); // Find first Sunday of September $date = new \DateTime('First Sunday of ' . $year . '-09', new \DateTimeZone(self::TIMEZONE)); // Go to next Thursday @@ -72,7 +72,7 @@ public function testJeuneGenevoisBetween1840And1869(): void */ public function testJeuneGenevoisBefore1840(): void { - $year = $this->generateRandomYear(1000, Geneva::JEUNE_GENEVOIS_ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, Geneva::JEUNE_GENEVOIS_ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -86,7 +86,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1966), + static::generateRandomYear(1966), [self::LOCALE => 'Jeûne genevois'] ); } @@ -101,7 +101,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1966), + static::generateRandomYear(1966), Holiday::TYPE_OTHER ); } diff --git a/tests/Switzerland/Geneva/NewYearsDayTest.php b/tests/Switzerland/Geneva/NewYearsDayTest.php index b7a69f5d2..f38688d8a 100644 --- a/tests/Switzerland/Geneva/NewYearsDayTest.php +++ b/tests/Switzerland/Geneva/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends GenevaBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nouvel An'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Geneva/PentecostMondayTest.php b/tests/Switzerland/Geneva/PentecostMondayTest.php index feace8ccb..3cc909b6b 100644 --- a/tests/Switzerland/Geneva/PentecostMondayTest.php +++ b/tests/Switzerland/Geneva/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pentecôte'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Geneva/RestaurationGenevoiseTest.php b/tests/Switzerland/Geneva/RestaurationGenevoiseTest.php index d3ee28e67..364f14ad7 100644 --- a/tests/Switzerland/Geneva/RestaurationGenevoiseTest.php +++ b/tests/Switzerland/Geneva/RestaurationGenevoiseTest.php @@ -37,7 +37,7 @@ class RestaurationGenevoiseTest extends GenevaBaseTestCase implements HolidayTes */ public function testRestaurationGenevoiseAfter1813(): void { - $year = $this->generateRandomYear(1814); + $year = static::generateRandomYear(1814); $this->assertHoliday( self::REGION, @@ -57,7 +57,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1814), + static::generateRandomYear(1814), [self::LOCALE => 'Restauration de la République'] ); } @@ -69,6 +69,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1814), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(1814), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Glarus/AllSaintsDayTest.php b/tests/Switzerland/Glarus/AllSaintsDayTest.php index 95858b0bb..41c4ff839 100644 --- a/tests/Switzerland/Glarus/AllSaintsDayTest.php +++ b/tests/Switzerland/Glarus/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends GlarusBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Glarus/AscensionDayTest.php b/tests/Switzerland/Glarus/AscensionDayTest.php index fbee216c4..6c1acb248 100644 --- a/tests/Switzerland/Glarus/AscensionDayTest.php +++ b/tests/Switzerland/Glarus/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Glarus/BerchtoldsTagTest.php b/tests/Switzerland/Glarus/BerchtoldsTagTest.php index 683beaae4..217756196 100644 --- a/tests/Switzerland/Glarus/BerchtoldsTagTest.php +++ b/tests/Switzerland/Glarus/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends GlarusBaseTestCase implements HolidayTestCase */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Berchtoldstag'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Glarus/ChristmasDayTest.php b/tests/Switzerland/Glarus/ChristmasDayTest.php index 784abaf34..4029e623a 100644 --- a/tests/Switzerland/Glarus/ChristmasDayTest.php +++ b/tests/Switzerland/Glarus/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends GlarusBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Glarus/EasterMondayTest.php b/tests/Switzerland/Glarus/EasterMondayTest.php index 10d97f088..10f29b0c9 100644 --- a/tests/Switzerland/Glarus/EasterMondayTest.php +++ b/tests/Switzerland/Glarus/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Glarus/GlarusTest.php b/tests/Switzerland/Glarus/GlarusTest.php index bb96c6144..76c0da5b1 100644 --- a/tests/Switzerland/Glarus/GlarusTest.php +++ b/tests/Switzerland/Glarus/GlarusTest.php @@ -37,7 +37,7 @@ class GlarusTest extends GlarusBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -105,7 +105,23 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'easterMonday', + 'nafelserFahrt', + 'ascensionDay', + 'pentecostMonday', + 'allSaintsDay', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Glarus/GoodFridayTest.php b/tests/Switzerland/Glarus/GoodFridayTest.php index c79e69fa6..893136274 100644 --- a/tests/Switzerland/Glarus/GoodFridayTest.php +++ b/tests/Switzerland/Glarus/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Glarus/NafelserFahrtTest.php b/tests/Switzerland/Glarus/NafelserFahrtTest.php index e14398a68..52701ab25 100644 --- a/tests/Switzerland/Glarus/NafelserFahrtTest.php +++ b/tests/Switzerland/Glarus/NafelserFahrtTest.php @@ -42,7 +42,7 @@ class NafelserFahrtTest extends GlarusBaseTestCase implements HolidayTestCase */ public function testNafelserFahrtOnAfter1389(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime('First Thursday of ' . $year . '-04', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -55,7 +55,7 @@ public function testNafelserFahrtOnAfter1389(): void */ public function testNafelserFahrtBefore1389(): void { - $year = $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -69,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Näfelser Fahrt'] ); } @@ -84,7 +84,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OTHER ); } diff --git a/tests/Switzerland/Glarus/NewYearsDayTest.php b/tests/Switzerland/Glarus/NewYearsDayTest.php index f1d5ad1d4..3a51f8201 100644 --- a/tests/Switzerland/Glarus/NewYearsDayTest.php +++ b/tests/Switzerland/Glarus/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends GlarusBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Glarus/PentecostMondayTest.php b/tests/Switzerland/Glarus/PentecostMondayTest.php index d502ff6e0..912e6963a 100644 --- a/tests/Switzerland/Glarus/PentecostMondayTest.php +++ b/tests/Switzerland/Glarus/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Glarus/StStephensDayTest.php b/tests/Switzerland/Glarus/StStephensDayTest.php index 14108408c..a4af73624 100644 --- a/tests/Switzerland/Glarus/StStephensDayTest.php +++ b/tests/Switzerland/Glarus/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends GlarusBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Grisons/AscensionDayTest.php b/tests/Switzerland/Grisons/AscensionDayTest.php index 181efa7a4..b84512581 100644 --- a/tests/Switzerland/Grisons/AscensionDayTest.php +++ b/tests/Switzerland/Grisons/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Grisons/ChristmasDayTest.php b/tests/Switzerland/Grisons/ChristmasDayTest.php index 0887c8811..eeb4eeb26 100644 --- a/tests/Switzerland/Grisons/ChristmasDayTest.php +++ b/tests/Switzerland/Grisons/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends GrisonsBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Grisons/EasterMondayTest.php b/tests/Switzerland/Grisons/EasterMondayTest.php index d8d10c6ba..e75a2f595 100644 --- a/tests/Switzerland/Grisons/EasterMondayTest.php +++ b/tests/Switzerland/Grisons/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Grisons/GoodFridayTest.php b/tests/Switzerland/Grisons/GoodFridayTest.php index ae5fe2fd3..409c68504 100644 --- a/tests/Switzerland/Grisons/GoodFridayTest.php +++ b/tests/Switzerland/Grisons/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Grisons/GrisonsTest.php b/tests/Switzerland/Grisons/GrisonsTest.php index ff06e5c9f..850a27b60 100644 --- a/tests/Switzerland/Grisons/GrisonsTest.php +++ b/tests/Switzerland/Grisons/GrisonsTest.php @@ -37,7 +37,7 @@ class GrisonsTest extends GrisonsBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -102,7 +102,20 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Grisons/NewYearsDayTest.php b/tests/Switzerland/Grisons/NewYearsDayTest.php index 5c209919b..e53049650 100644 --- a/tests/Switzerland/Grisons/NewYearsDayTest.php +++ b/tests/Switzerland/Grisons/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends GrisonsBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Grisons/PentecostMondayTest.php b/tests/Switzerland/Grisons/PentecostMondayTest.php index dc8cf44aa..2e2213040 100644 --- a/tests/Switzerland/Grisons/PentecostMondayTest.php +++ b/tests/Switzerland/Grisons/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Grisons/StStephensDayTest.php b/tests/Switzerland/Grisons/StStephensDayTest.php index 7788bc021..13a8c9697 100644 --- a/tests/Switzerland/Grisons/StStephensDayTest.php +++ b/tests/Switzerland/Grisons/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends GrisonsBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/AllSaintsDayTest.php b/tests/Switzerland/Jura/AllSaintsDayTest.php index eb1de386f..4916d1a6d 100644 --- a/tests/Switzerland/Jura/AllSaintsDayTest.php +++ b/tests/Switzerland/Jura/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends JuraBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Toussaint'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Jura/AscensionDayTest.php b/tests/Switzerland/Jura/AscensionDayTest.php index 9830c0048..567749a57 100644 --- a/tests/Switzerland/Jura/AscensionDayTest.php +++ b/tests/Switzerland/Jura/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ascension'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/AssumptionOfMaryTest.php b/tests/Switzerland/Jura/AssumptionOfMaryTest.php index ae9a928cc..49cff7116 100644 --- a/tests/Switzerland/Jura/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Jura/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends JuraBaseTestCase implements HolidayTestCase /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Assomption'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/Jura/BerchtoldsTagTest.php b/tests/Switzerland/Jura/BerchtoldsTagTest.php index aef947155..bb8ace892 100644 --- a/tests/Switzerland/Jura/BerchtoldsTagTest.php +++ b/tests/Switzerland/Jura/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends JuraBaseTestCase implements HolidayTestCase */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Jour de la Saint-Berthold'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/BettagsMontagTest.php b/tests/Switzerland/Jura/BettagsMontagTest.php index 5add3a5d5..4818d3171 100644 --- a/tests/Switzerland/Jura/BettagsMontagTest.php +++ b/tests/Switzerland/Jura/BettagsMontagTest.php @@ -37,7 +37,7 @@ class BettagsMontagTest extends JuraBaseTestCase implements HolidayTestCase */ public function testBettagsMontagOnAfter1832(): void { - $year = $this->generateRandomYear(1832); + $year = static::generateRandomYear(1832); // Find third Sunday of September $date = new \DateTime('Third Sunday of ' . $year . '-09', new \DateTimeZone(self::TIMEZONE)); @@ -54,7 +54,7 @@ public function testBettagsMontagOnAfter1832(): void */ public function testBettagsMontagBefore1832(): void { - $year = $this->generateRandomYear(1000, 1831); + $year = static::generateRandomYear(1000, 1831); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -68,7 +68,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1832), + static::generateRandomYear(1832), [self::LOCALE => 'Jeûne fédéral'] ); } @@ -80,6 +80,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1900), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(1900), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/ChristmasDayTest.php b/tests/Switzerland/Jura/ChristmasDayTest.php index a62f0ca26..b4ffd4825 100644 --- a/tests/Switzerland/Jura/ChristmasDayTest.php +++ b/tests/Switzerland/Jura/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends JuraBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Noël'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/CorpusChristiTest.php b/tests/Switzerland/Jura/CorpusChristiTest.php index b3aeab343..e9565961d 100644 --- a/tests/Switzerland/Jura/CorpusChristiTest.php +++ b/tests/Switzerland/Jura/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fête-Dieu'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/EasterMondayTest.php b/tests/Switzerland/Jura/EasterMondayTest.php index bd50b247f..7b55239d6 100644 --- a/tests/Switzerland/Jura/EasterMondayTest.php +++ b/tests/Switzerland/Jura/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pâques'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/EasterTest.php b/tests/Switzerland/Jura/EasterTest.php index 6061cf1b2..d695bdbad 100644 --- a/tests/Switzerland/Jura/EasterTest.php +++ b/tests/Switzerland/Jura/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pâques'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/GoodFridayTest.php b/tests/Switzerland/Jura/GoodFridayTest.php index eeca407ed..67dff4339 100644 --- a/tests/Switzerland/Jura/GoodFridayTest.php +++ b/tests/Switzerland/Jura/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vendredi Saint'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/JuraTest.php b/tests/Switzerland/Jura/JuraTest.php index bc124b602..619b7b300 100644 --- a/tests/Switzerland/Jura/JuraTest.php +++ b/tests/Switzerland/Jura/JuraTest.php @@ -37,7 +37,7 @@ class JuraTest extends JuraBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1975); + $this->year = static::generateRandomYear(1975); } /** @@ -110,7 +110,28 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'easter', + 'easterMonday', + 'internationalWorkersDay', + 'ascensionDay', + 'pentecost', + 'pentecostMonday', + 'corpusChristi', + 'plebisciteJurassien', + 'assumptionOfMary', + 'bettagsMontag', + 'allSaintsDay', + 'christmasDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Jura/NewYearsDayTest.php b/tests/Switzerland/Jura/NewYearsDayTest.php index 2c2030ed9..d61d3ac03 100644 --- a/tests/Switzerland/Jura/NewYearsDayTest.php +++ b/tests/Switzerland/Jura/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends JuraBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nouvel An'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Jura/PentecostMondayTest.php b/tests/Switzerland/Jura/PentecostMondayTest.php index ae951bd86..8b96ade8c 100644 --- a/tests/Switzerland/Jura/PentecostMondayTest.php +++ b/tests/Switzerland/Jura/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pentecôte'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/PentecostTest.php b/tests/Switzerland/Jura/PentecostTest.php index 6849018eb..d9e1a30e8 100644 --- a/tests/Switzerland/Jura/PentecostTest.php +++ b/tests/Switzerland/Jura/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pentecôte'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Jura/PlebisciteJurassienTest.php b/tests/Switzerland/Jura/PlebisciteJurassienTest.php index a83f25604..d451a6fe6 100644 --- a/tests/Switzerland/Jura/PlebisciteJurassienTest.php +++ b/tests/Switzerland/Jura/PlebisciteJurassienTest.php @@ -42,7 +42,7 @@ class PlebisciteJurassienTest extends JuraBaseTestCase implements HolidayTestCas */ public function testInstaurationRepubliqueOnAfter1975(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testInstaurationRepubliqueBefore1975(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Commémoration du plébiscite jurassien'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OTHER ); } diff --git a/tests/Switzerland/Jura/WorkersDayTest.php b/tests/Switzerland/Jura/WorkersDayTest.php index c52fd08d2..fb614a9dd 100644 --- a/tests/Switzerland/Jura/WorkersDayTest.php +++ b/tests/Switzerland/Jura/WorkersDayTest.php @@ -33,13 +33,12 @@ class WorkersDayTest extends JuraBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -53,12 +52,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-5-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -76,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fête du Travail'] ); } @@ -88,6 +87,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Lucerne/AllSaintsDayTest.php b/tests/Switzerland/Lucerne/AllSaintsDayTest.php index 74e315009..f1e6c6331 100644 --- a/tests/Switzerland/Lucerne/AllSaintsDayTest.php +++ b/tests/Switzerland/Lucerne/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends LucerneBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Lucerne/AscensionDayTest.php b/tests/Switzerland/Lucerne/AscensionDayTest.php index 075e072a7..1cea654d6 100644 --- a/tests/Switzerland/Lucerne/AscensionDayTest.php +++ b/tests/Switzerland/Lucerne/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Lucerne/AssumptionOfMaryTest.php b/tests/Switzerland/Lucerne/AssumptionOfMaryTest.php index fd322448a..e9d7ec383 100644 --- a/tests/Switzerland/Lucerne/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Lucerne/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends LucerneBaseTestCase implements HolidayTestCas /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Himmelfahrt'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/Lucerne/BerchtoldsTagTest.php b/tests/Switzerland/Lucerne/BerchtoldsTagTest.php index 0656d8e3f..8b34adbf2 100644 --- a/tests/Switzerland/Lucerne/BerchtoldsTagTest.php +++ b/tests/Switzerland/Lucerne/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends LucerneBaseTestCase implements HolidayTestCase */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Berchtoldstag'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Lucerne/ChristmasDayTest.php b/tests/Switzerland/Lucerne/ChristmasDayTest.php index f1a3a930a..3013101eb 100644 --- a/tests/Switzerland/Lucerne/ChristmasDayTest.php +++ b/tests/Switzerland/Lucerne/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends LucerneBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Lucerne/CorpusChristiTest.php b/tests/Switzerland/Lucerne/CorpusChristiTest.php index b144c3735..25edd2d2e 100644 --- a/tests/Switzerland/Lucerne/CorpusChristiTest.php +++ b/tests/Switzerland/Lucerne/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Lucerne/EasterMondayTest.php b/tests/Switzerland/Lucerne/EasterMondayTest.php index 598f2d64e..bdf05c44d 100644 --- a/tests/Switzerland/Lucerne/EasterMondayTest.php +++ b/tests/Switzerland/Lucerne/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Lucerne/GoodFridayTest.php b/tests/Switzerland/Lucerne/GoodFridayTest.php index cc1406989..9361c9994 100644 --- a/tests/Switzerland/Lucerne/GoodFridayTest.php +++ b/tests/Switzerland/Lucerne/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Lucerne/ImmaculateConceptionTest.php b/tests/Switzerland/Lucerne/ImmaculateConceptionTest.php index 03a706d97..7f9c609db 100644 --- a/tests/Switzerland/Lucerne/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Lucerne/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends LucerneBaseTestCase implements HolidayTes /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Empfängnis'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Lucerne/LucerneTest.php b/tests/Switzerland/Lucerne/LucerneTest.php index 7eed3f6ed..b49fde147 100644 --- a/tests/Switzerland/Lucerne/LucerneTest.php +++ b/tests/Switzerland/Lucerne/LucerneTest.php @@ -37,7 +37,7 @@ class LucerneTest extends LucerneBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -107,7 +107,25 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'corpusChristi', + 'assumptionOfMary', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Lucerne/NewYearsDayTest.php b/tests/Switzerland/Lucerne/NewYearsDayTest.php index ac6c8d35a..be1e5ab77 100644 --- a/tests/Switzerland/Lucerne/NewYearsDayTest.php +++ b/tests/Switzerland/Lucerne/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends LucerneBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Lucerne/PentecostMondayTest.php b/tests/Switzerland/Lucerne/PentecostMondayTest.php index a4fab9977..62e0e3924 100644 --- a/tests/Switzerland/Lucerne/PentecostMondayTest.php +++ b/tests/Switzerland/Lucerne/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Lucerne/StStephensDayTest.php b/tests/Switzerland/Lucerne/StStephensDayTest.php index 375e7f709..5c33a610f 100644 --- a/tests/Switzerland/Lucerne/StStephensDayTest.php +++ b/tests/Switzerland/Lucerne/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends LucerneBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Neuchatel/AscensionDayTest.php b/tests/Switzerland/Neuchatel/AscensionDayTest.php index 7466e713c..3f5ebefe5 100644 --- a/tests/Switzerland/Neuchatel/AscensionDayTest.php +++ b/tests/Switzerland/Neuchatel/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ascension'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Neuchatel/BettagsMontagTest.php b/tests/Switzerland/Neuchatel/BettagsMontagTest.php index a3346a4b1..376558f47 100644 --- a/tests/Switzerland/Neuchatel/BettagsMontagTest.php +++ b/tests/Switzerland/Neuchatel/BettagsMontagTest.php @@ -37,7 +37,7 @@ class BettagsMontagTest extends NeuchatelBaseTestCase implements HolidayTestCase */ public function testBettagsMontagOnAfter1832(): void { - $year = $this->generateRandomYear(1832); + $year = static::generateRandomYear(1832); // Find third Sunday of September $date = new \DateTime('Third Sunday of ' . $year . '-09', new \DateTimeZone(self::TIMEZONE)); @@ -54,7 +54,7 @@ public function testBettagsMontagOnAfter1832(): void */ public function testBettagsMontagBefore1832(): void { - $year = $this->generateRandomYear(1000, 1831); + $year = static::generateRandomYear(1000, 1831); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -68,7 +68,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1832), + static::generateRandomYear(1832), [self::LOCALE => 'Jeûne fédéral'] ); } @@ -80,6 +80,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1900), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(1900), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Neuchatel/ChristmasDayTest.php b/tests/Switzerland/Neuchatel/ChristmasDayTest.php index 4e0f4115a..1037f4a6f 100644 --- a/tests/Switzerland/Neuchatel/ChristmasDayTest.php +++ b/tests/Switzerland/Neuchatel/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends NeuchatelBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Noël'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Neuchatel/EasterMondayTest.php b/tests/Switzerland/Neuchatel/EasterMondayTest.php index 2c03c7eee..304a1ac63 100644 --- a/tests/Switzerland/Neuchatel/EasterMondayTest.php +++ b/tests/Switzerland/Neuchatel/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pâques'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Neuchatel/GoodFridayTest.php b/tests/Switzerland/Neuchatel/GoodFridayTest.php index ced41c4cd..7213ff589 100644 --- a/tests/Switzerland/Neuchatel/GoodFridayTest.php +++ b/tests/Switzerland/Neuchatel/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vendredi Saint'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Neuchatel/InstaurationRepubliqueTest.php b/tests/Switzerland/Neuchatel/InstaurationRepubliqueTest.php index 891539ebc..94080d9a9 100644 --- a/tests/Switzerland/Neuchatel/InstaurationRepubliqueTest.php +++ b/tests/Switzerland/Neuchatel/InstaurationRepubliqueTest.php @@ -42,7 +42,7 @@ class InstaurationRepubliqueTest extends NeuchatelBaseTestCase implements Holida */ public function testInstaurationRepubliqueOnAfter1849(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testInstaurationRepubliqueBefore1849(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Instauration de la République'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OTHER ); } diff --git a/tests/Switzerland/Neuchatel/NeuchatelTest.php b/tests/Switzerland/Neuchatel/NeuchatelTest.php index a49ec55e7..912a34bb6 100644 --- a/tests/Switzerland/Neuchatel/NeuchatelTest.php +++ b/tests/Switzerland/Neuchatel/NeuchatelTest.php @@ -37,7 +37,7 @@ class NeuchatelTest extends NeuchatelBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -104,7 +104,22 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'instaurationRepublique', + 'goodFriday', + 'easterMonday', + 'internationalWorkersDay', + 'ascensionDay', + 'pentecostMonday', + 'bettagsMontag', + 'christmasDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Neuchatel/NewYearsDayTest.php b/tests/Switzerland/Neuchatel/NewYearsDayTest.php index ea229bc65..7058aa0ce 100644 --- a/tests/Switzerland/Neuchatel/NewYearsDayTest.php +++ b/tests/Switzerland/Neuchatel/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends NeuchatelBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nouvel An'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Neuchatel/PentecostMondayTest.php b/tests/Switzerland/Neuchatel/PentecostMondayTest.php index e8a3ba0e8..71b9431a8 100644 --- a/tests/Switzerland/Neuchatel/PentecostMondayTest.php +++ b/tests/Switzerland/Neuchatel/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pentecôte'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Neuchatel/WorkersDayTest.php b/tests/Switzerland/Neuchatel/WorkersDayTest.php index a9ec86c4c..ba8c82cde 100644 --- a/tests/Switzerland/Neuchatel/WorkersDayTest.php +++ b/tests/Switzerland/Neuchatel/WorkersDayTest.php @@ -33,13 +33,12 @@ class WorkersDayTest extends NeuchatelBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -53,12 +52,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-5-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -76,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fête du Travail'] ); } @@ -88,6 +87,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Nidwalden/AllSaintsDayTest.php b/tests/Switzerland/Nidwalden/AllSaintsDayTest.php index b40e6a600..63bb2590f 100644 --- a/tests/Switzerland/Nidwalden/AllSaintsDayTest.php +++ b/tests/Switzerland/Nidwalden/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends NidwaldenBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Nidwalden/AscensionDayTest.php b/tests/Switzerland/Nidwalden/AscensionDayTest.php index 5aa857f5b..a4d06b017 100644 --- a/tests/Switzerland/Nidwalden/AscensionDayTest.php +++ b/tests/Switzerland/Nidwalden/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Nidwalden/AssumptionOfMaryTest.php b/tests/Switzerland/Nidwalden/AssumptionOfMaryTest.php index 3f22b8e77..87adedac7 100644 --- a/tests/Switzerland/Nidwalden/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Nidwalden/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends NidwaldenBaseTestCase implements HolidayTestC /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Himmelfahrt'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/Nidwalden/ChristmasDayTest.php b/tests/Switzerland/Nidwalden/ChristmasDayTest.php index 047f1e6a2..063d85bc3 100644 --- a/tests/Switzerland/Nidwalden/ChristmasDayTest.php +++ b/tests/Switzerland/Nidwalden/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends NidwaldenBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Nidwalden/CorpusChristiTest.php b/tests/Switzerland/Nidwalden/CorpusChristiTest.php index 84bbf10aa..f48fc8e61 100644 --- a/tests/Switzerland/Nidwalden/CorpusChristiTest.php +++ b/tests/Switzerland/Nidwalden/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Nidwalden/EasterMondayTest.php b/tests/Switzerland/Nidwalden/EasterMondayTest.php index c8f8824b3..93ac66c8a 100644 --- a/tests/Switzerland/Nidwalden/EasterMondayTest.php +++ b/tests/Switzerland/Nidwalden/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Nidwalden/GoodFridayTest.php b/tests/Switzerland/Nidwalden/GoodFridayTest.php index 09b3f91ea..8fe75839d 100644 --- a/tests/Switzerland/Nidwalden/GoodFridayTest.php +++ b/tests/Switzerland/Nidwalden/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Nidwalden/ImmaculateConceptionTest.php b/tests/Switzerland/Nidwalden/ImmaculateConceptionTest.php index 770504a2e..55ac472a8 100644 --- a/tests/Switzerland/Nidwalden/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Nidwalden/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends NidwaldenBaseTestCase implements HolidayT /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Empfängnis'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Nidwalden/NewYearsDayTest.php b/tests/Switzerland/Nidwalden/NewYearsDayTest.php index eda1b663b..02ffe4389 100644 --- a/tests/Switzerland/Nidwalden/NewYearsDayTest.php +++ b/tests/Switzerland/Nidwalden/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends NidwaldenBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Nidwalden/NidwaldenTest.php b/tests/Switzerland/Nidwalden/NidwaldenTest.php index 9e21431b3..61e19d611 100644 --- a/tests/Switzerland/Nidwalden/NidwaldenTest.php +++ b/tests/Switzerland/Nidwalden/NidwaldenTest.php @@ -37,7 +37,7 @@ class NidwaldenTest extends NidwaldenBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -107,7 +107,25 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'stJosephsDay', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'corpusChristi', + 'assumptionOfMary', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Nidwalden/PentecostMondayTest.php b/tests/Switzerland/Nidwalden/PentecostMondayTest.php index 31fa88199..1c747498e 100644 --- a/tests/Switzerland/Nidwalden/PentecostMondayTest.php +++ b/tests/Switzerland/Nidwalden/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Nidwalden/StJosephDayTest.php b/tests/Switzerland/Nidwalden/StJosephDayTest.php index 14cbc40bb..22dcb1396 100644 --- a/tests/Switzerland/Nidwalden/StJosephDayTest.php +++ b/tests/Switzerland/Nidwalden/StJosephDayTest.php @@ -36,11 +36,10 @@ class StJosephDayTest extends NidwaldenBaseTestCase implements HolidayTestCase /** * Tests St. Joseph's Day. * - * @dataProvider StJosephDayDataProvider - * * @param int $year the year for which St. Joseph's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StJosephDayDataProvider')] public function testStJosephDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,9 +52,9 @@ public function testStJosephDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StJosephDayDataProvider(): array + public static function StJosephDayDataProvider(): array { - return $this->generateRandomDates(3, 19, self::TIMEZONE); + return static::generateRandomDates(3, 19, self::TIMEZONE); } /** @@ -68,7 +67,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Josephstag'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Nidwalden/StStephensDayTest.php b/tests/Switzerland/Nidwalden/StStephensDayTest.php index 8625aa837..dfd3e46ad 100644 --- a/tests/Switzerland/Nidwalden/StStephensDayTest.php +++ b/tests/Switzerland/Nidwalden/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends NidwaldenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Obwalden/AllSaintsDayTest.php b/tests/Switzerland/Obwalden/AllSaintsDayTest.php index b8fb3cade..f8630f3cc 100644 --- a/tests/Switzerland/Obwalden/AllSaintsDayTest.php +++ b/tests/Switzerland/Obwalden/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends ObwaldenBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Obwalden/AscensionDayTest.php b/tests/Switzerland/Obwalden/AscensionDayTest.php index 107b18c14..9a0b233e7 100644 --- a/tests/Switzerland/Obwalden/AscensionDayTest.php +++ b/tests/Switzerland/Obwalden/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Obwalden/AssumptionOfMaryTest.php b/tests/Switzerland/Obwalden/AssumptionOfMaryTest.php index 2074e04b4..3dd55f851 100644 --- a/tests/Switzerland/Obwalden/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Obwalden/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends ObwaldenBaseTestCase implements HolidayTestCa /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Himmelfahrt'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/Obwalden/BerchtoldsTagTest.php b/tests/Switzerland/Obwalden/BerchtoldsTagTest.php index 70d9cad04..671526f0b 100644 --- a/tests/Switzerland/Obwalden/BerchtoldsTagTest.php +++ b/tests/Switzerland/Obwalden/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends ObwaldenBaseTestCase implements HolidayTestCase */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Berchtoldstag'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Obwalden/BruderKlausenFestTest.php b/tests/Switzerland/Obwalden/BruderKlausenFestTest.php index 131b2ed19..3d0633d37 100644 --- a/tests/Switzerland/Obwalden/BruderKlausenFestTest.php +++ b/tests/Switzerland/Obwalden/BruderKlausenFestTest.php @@ -37,7 +37,7 @@ class BruderKlausenFestTest extends ObwaldenBaseTestCase implements HolidayTestC */ public function testBruderKlausenFestOnAfter1947(): void { - $year = $this->generateRandomYear(1947); + $year = static::generateRandomYear(1947); $date = new \DateTime($year . '-09-25', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -51,7 +51,7 @@ public function testBruderKlausenFestOnAfter1947(): void */ public function testBruderKlausenFestBetween1649And1946(): void { - $year = $this->generateRandomYear(1649, 1946); + $year = static::generateRandomYear(1649, 1946); $date = new \DateTime($year . '-09-21', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -65,7 +65,7 @@ public function testBruderKlausenFestBetween1649And1946(): void */ public function testBruderKlausenFestBefore1648(): void { - $year = $this->generateRandomYear(1000, 1648); + $year = static::generateRandomYear(1000, 1648); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -79,7 +79,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1947), + static::generateRandomYear(1947), [self::LOCALE => 'Bruder-Klausen-Fest'] ); } @@ -91,6 +91,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1947), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(1947), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Obwalden/ChristmasDayTest.php b/tests/Switzerland/Obwalden/ChristmasDayTest.php index 3c13ebf66..94d566c2b 100644 --- a/tests/Switzerland/Obwalden/ChristmasDayTest.php +++ b/tests/Switzerland/Obwalden/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends ObwaldenBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Obwalden/CorpusChristiTest.php b/tests/Switzerland/Obwalden/CorpusChristiTest.php index ccc901002..247185fe1 100644 --- a/tests/Switzerland/Obwalden/CorpusChristiTest.php +++ b/tests/Switzerland/Obwalden/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Obwalden/EasterMondayTest.php b/tests/Switzerland/Obwalden/EasterMondayTest.php index 5c4448894..f0b8e55a5 100644 --- a/tests/Switzerland/Obwalden/EasterMondayTest.php +++ b/tests/Switzerland/Obwalden/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Obwalden/GoodFridayTest.php b/tests/Switzerland/Obwalden/GoodFridayTest.php index fc428f706..b5ac0d96a 100644 --- a/tests/Switzerland/Obwalden/GoodFridayTest.php +++ b/tests/Switzerland/Obwalden/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Obwalden/ImmaculateConceptionTest.php b/tests/Switzerland/Obwalden/ImmaculateConceptionTest.php index 274eef306..c83baba2e 100644 --- a/tests/Switzerland/Obwalden/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Obwalden/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends ObwaldenBaseTestCase implements HolidayTe /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Empfängnis'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Obwalden/NewYearsDayTest.php b/tests/Switzerland/Obwalden/NewYearsDayTest.php index 25a591d05..e2f5eb4e0 100644 --- a/tests/Switzerland/Obwalden/NewYearsDayTest.php +++ b/tests/Switzerland/Obwalden/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends ObwaldenBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Obwalden/ObwaldenTest.php b/tests/Switzerland/Obwalden/ObwaldenTest.php index ea751f847..4019ca369 100644 --- a/tests/Switzerland/Obwalden/ObwaldenTest.php +++ b/tests/Switzerland/Obwalden/ObwaldenTest.php @@ -37,7 +37,7 @@ class ObwaldenTest extends ObwaldenBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -108,7 +108,26 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'corpusChristi', + 'assumptionOfMary', + 'bruderKlausenFest', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Obwalden/PentecostMondayTest.php b/tests/Switzerland/Obwalden/PentecostMondayTest.php index e6d19b669..6262f7bf6 100644 --- a/tests/Switzerland/Obwalden/PentecostMondayTest.php +++ b/tests/Switzerland/Obwalden/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Obwalden/StStephensDayTest.php b/tests/Switzerland/Obwalden/StStephensDayTest.php index 3e3bc8cdd..849899936 100644 --- a/tests/Switzerland/Obwalden/StStephensDayTest.php +++ b/tests/Switzerland/Obwalden/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends ObwaldenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schaffhausen/AscensionDayTest.php b/tests/Switzerland/Schaffhausen/AscensionDayTest.php index 99f808b6c..2394fb019 100644 --- a/tests/Switzerland/Schaffhausen/AscensionDayTest.php +++ b/tests/Switzerland/Schaffhausen/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schaffhausen/BerchtoldsTagTest.php b/tests/Switzerland/Schaffhausen/BerchtoldsTagTest.php index c5d6ae89e..58417e6d0 100644 --- a/tests/Switzerland/Schaffhausen/BerchtoldsTagTest.php +++ b/tests/Switzerland/Schaffhausen/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends SchaffhausenBaseTestCase implements HolidayTestC */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Berchtoldstag'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schaffhausen/ChristmasDayTest.php b/tests/Switzerland/Schaffhausen/ChristmasDayTest.php index ac23d3917..6190e3b1c 100644 --- a/tests/Switzerland/Schaffhausen/ChristmasDayTest.php +++ b/tests/Switzerland/Schaffhausen/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends SchaffhausenBaseTestCase implements HolidayTestCa /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schaffhausen/EasterMondayTest.php b/tests/Switzerland/Schaffhausen/EasterMondayTest.php index 135c71717..cdb29bae0 100644 --- a/tests/Switzerland/Schaffhausen/EasterMondayTest.php +++ b/tests/Switzerland/Schaffhausen/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schaffhausen/GoodFridayTest.php b/tests/Switzerland/Schaffhausen/GoodFridayTest.php index 5f803117e..88de4e1c0 100644 --- a/tests/Switzerland/Schaffhausen/GoodFridayTest.php +++ b/tests/Switzerland/Schaffhausen/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schaffhausen/NewYearsDayTest.php b/tests/Switzerland/Schaffhausen/NewYearsDayTest.php index 49aced36e..6c39687dc 100644 --- a/tests/Switzerland/Schaffhausen/NewYearsDayTest.php +++ b/tests/Switzerland/Schaffhausen/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends SchaffhausenBaseTestCase implements HolidayTestCas /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Schaffhausen/PentecostMondayTest.php b/tests/Switzerland/Schaffhausen/PentecostMondayTest.php index bb88e7d90..7efe7fd7e 100644 --- a/tests/Switzerland/Schaffhausen/PentecostMondayTest.php +++ b/tests/Switzerland/Schaffhausen/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schaffhausen/SchaffhausenTest.php b/tests/Switzerland/Schaffhausen/SchaffhausenTest.php index d3459de9a..f002d742c 100644 --- a/tests/Switzerland/Schaffhausen/SchaffhausenTest.php +++ b/tests/Switzerland/Schaffhausen/SchaffhausenTest.php @@ -37,7 +37,7 @@ class SchaffhausenTest extends SchaffhausenBaseTestCase implements ProviderTestC */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -104,7 +104,22 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'easterMonday', + 'internationalWorkersDay', + 'ascensionDay', + 'pentecostMonday', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Schaffhausen/StStephensDayTest.php b/tests/Switzerland/Schaffhausen/StStephensDayTest.php index 14eb411c4..402591271 100644 --- a/tests/Switzerland/Schaffhausen/StStephensDayTest.php +++ b/tests/Switzerland/Schaffhausen/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends SchaffhausenBaseTestCase implements HolidayTestC /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schaffhausen/WorkersDayTest.php b/tests/Switzerland/Schaffhausen/WorkersDayTest.php index de9eda03e..2a28a0f48 100644 --- a/tests/Switzerland/Schaffhausen/WorkersDayTest.php +++ b/tests/Switzerland/Schaffhausen/WorkersDayTest.php @@ -33,13 +33,12 @@ class WorkersDayTest extends SchaffhausenBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -53,12 +52,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-5-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -76,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Tag der Arbeit'] ); } @@ -88,6 +87,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schwyz/AllSaintsDayTest.php b/tests/Switzerland/Schwyz/AllSaintsDayTest.php index 08d0a4259..688fddd5c 100644 --- a/tests/Switzerland/Schwyz/AllSaintsDayTest.php +++ b/tests/Switzerland/Schwyz/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends SchwyzBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Schwyz/AscensionDayTest.php b/tests/Switzerland/Schwyz/AscensionDayTest.php index 1ab58768e..1fd0c8dd7 100644 --- a/tests/Switzerland/Schwyz/AscensionDayTest.php +++ b/tests/Switzerland/Schwyz/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schwyz/AssumptionOfMaryTest.php b/tests/Switzerland/Schwyz/AssumptionOfMaryTest.php index efcaf0c14..3247d7f03 100644 --- a/tests/Switzerland/Schwyz/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Schwyz/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends SchwyzBaseTestCase implements HolidayTestCase /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Himmelfahrt'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/Schwyz/ChristmasDayTest.php b/tests/Switzerland/Schwyz/ChristmasDayTest.php index a504647fa..dced19bbf 100644 --- a/tests/Switzerland/Schwyz/ChristmasDayTest.php +++ b/tests/Switzerland/Schwyz/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends SchwyzBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schwyz/CorpusChristiTest.php b/tests/Switzerland/Schwyz/CorpusChristiTest.php index 86d6a4e5d..27e555d43 100644 --- a/tests/Switzerland/Schwyz/CorpusChristiTest.php +++ b/tests/Switzerland/Schwyz/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schwyz/EasterMondayTest.php b/tests/Switzerland/Schwyz/EasterMondayTest.php index ca2718c2e..4eeca9c4d 100644 --- a/tests/Switzerland/Schwyz/EasterMondayTest.php +++ b/tests/Switzerland/Schwyz/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schwyz/EpiphanyTest.php b/tests/Switzerland/Schwyz/EpiphanyTest.php index 31d949230..4c231a15c 100644 --- a/tests/Switzerland/Schwyz/EpiphanyTest.php +++ b/tests/Switzerland/Schwyz/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends SchwyzBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Heilige Drei Könige'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schwyz/GoodFridayTest.php b/tests/Switzerland/Schwyz/GoodFridayTest.php index 258ae5556..8a4d032db 100644 --- a/tests/Switzerland/Schwyz/GoodFridayTest.php +++ b/tests/Switzerland/Schwyz/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schwyz/ImmaculateConceptionTest.php b/tests/Switzerland/Schwyz/ImmaculateConceptionTest.php index 374c8044e..dd9b6b001 100644 --- a/tests/Switzerland/Schwyz/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Schwyz/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends SchwyzBaseTestCase implements HolidayTest /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Empfängnis'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schwyz/NewYearsDayTest.php b/tests/Switzerland/Schwyz/NewYearsDayTest.php index aad546c50..e8595645e 100644 --- a/tests/Switzerland/Schwyz/NewYearsDayTest.php +++ b/tests/Switzerland/Schwyz/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends SchwyzBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Schwyz/PentecostMondayTest.php b/tests/Switzerland/Schwyz/PentecostMondayTest.php index 408454147..3958008a2 100644 --- a/tests/Switzerland/Schwyz/PentecostMondayTest.php +++ b/tests/Switzerland/Schwyz/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schwyz/SchwyzTest.php b/tests/Switzerland/Schwyz/SchwyzTest.php index a3a58726e..9b0d8c140 100644 --- a/tests/Switzerland/Schwyz/SchwyzTest.php +++ b/tests/Switzerland/Schwyz/SchwyzTest.php @@ -37,7 +37,7 @@ class SchwyzTest extends SchwyzBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -108,7 +108,26 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'epiphany', + 'stJosephsDay', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'corpusChristi', + 'assumptionOfMary', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Schwyz/StJosephDayTest.php b/tests/Switzerland/Schwyz/StJosephDayTest.php index 0dd5fb206..34ecdceba 100644 --- a/tests/Switzerland/Schwyz/StJosephDayTest.php +++ b/tests/Switzerland/Schwyz/StJosephDayTest.php @@ -36,11 +36,10 @@ class StJosephDayTest extends SchwyzBaseTestCase implements HolidayTestCase /** * Tests St. Joseph's Day. * - * @dataProvider StJosephDayDataProvider - * * @param int $year the year for which St. Joseph's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StJosephDayDataProvider')] public function testStJosephDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,9 +52,9 @@ public function testStJosephDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StJosephDayDataProvider(): array + public static function StJosephDayDataProvider(): array { - return $this->generateRandomDates(3, 19, self::TIMEZONE); + return static::generateRandomDates(3, 19, self::TIMEZONE); } /** @@ -68,7 +67,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Josephstag'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Schwyz/StStephensDayTest.php b/tests/Switzerland/Schwyz/StStephensDayTest.php index 2fb0f21a4..eff31c2e9 100644 --- a/tests/Switzerland/Schwyz/StStephensDayTest.php +++ b/tests/Switzerland/Schwyz/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends SchwyzBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Solothurn/AscensionDayTest.php b/tests/Switzerland/Solothurn/AscensionDayTest.php index 0806a6e66..680f0b64d 100644 --- a/tests/Switzerland/Solothurn/AscensionDayTest.php +++ b/tests/Switzerland/Solothurn/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Solothurn/BerchtoldsTagTest.php b/tests/Switzerland/Solothurn/BerchtoldsTagTest.php index f2cb96075..956434d1a 100644 --- a/tests/Switzerland/Solothurn/BerchtoldsTagTest.php +++ b/tests/Switzerland/Solothurn/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends SolothurnBaseTestCase implements HolidayTestCase */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Berchtoldstag'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Solothurn/ChristmasDayTest.php b/tests/Switzerland/Solothurn/ChristmasDayTest.php index 96d07373e..82bac1b0d 100644 --- a/tests/Switzerland/Solothurn/ChristmasDayTest.php +++ b/tests/Switzerland/Solothurn/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends SolothurnBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Solothurn/GoodFridayTest.php b/tests/Switzerland/Solothurn/GoodFridayTest.php index 007245242..eab8a71ed 100644 --- a/tests/Switzerland/Solothurn/GoodFridayTest.php +++ b/tests/Switzerland/Solothurn/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Solothurn/NewYearsDayTest.php b/tests/Switzerland/Solothurn/NewYearsDayTest.php index ce8a84c88..356facaf2 100644 --- a/tests/Switzerland/Solothurn/NewYearsDayTest.php +++ b/tests/Switzerland/Solothurn/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends SolothurnBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Solothurn/SolothurnTest.php b/tests/Switzerland/Solothurn/SolothurnTest.php index d70d647d6..dc9063356 100644 --- a/tests/Switzerland/Solothurn/SolothurnTest.php +++ b/tests/Switzerland/Solothurn/SolothurnTest.php @@ -37,7 +37,7 @@ class SolothurnTest extends SolothurnBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -101,7 +101,18 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'ascensionDay', + 'christmasDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/StGallen/AllSaintsDayTest.php b/tests/Switzerland/StGallen/AllSaintsDayTest.php index a755a177a..a6214af67 100644 --- a/tests/Switzerland/StGallen/AllSaintsDayTest.php +++ b/tests/Switzerland/StGallen/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends StGallenBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/StGallen/AscensionDayTest.php b/tests/Switzerland/StGallen/AscensionDayTest.php index 6d302c7a8..da238eba3 100644 --- a/tests/Switzerland/StGallen/AscensionDayTest.php +++ b/tests/Switzerland/StGallen/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/StGallen/ChristmasDayTest.php b/tests/Switzerland/StGallen/ChristmasDayTest.php index 7f20f9c07..08659bc8c 100644 --- a/tests/Switzerland/StGallen/ChristmasDayTest.php +++ b/tests/Switzerland/StGallen/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends StGallenBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/StGallen/EasterMondayTest.php b/tests/Switzerland/StGallen/EasterMondayTest.php index 33c036240..10e2e0fb9 100644 --- a/tests/Switzerland/StGallen/EasterMondayTest.php +++ b/tests/Switzerland/StGallen/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/StGallen/GoodFridayTest.php b/tests/Switzerland/StGallen/GoodFridayTest.php index df5c6f09c..75950e560 100644 --- a/tests/Switzerland/StGallen/GoodFridayTest.php +++ b/tests/Switzerland/StGallen/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/StGallen/NewYearsDayTest.php b/tests/Switzerland/StGallen/NewYearsDayTest.php index 66f459689..ee08d1e89 100644 --- a/tests/Switzerland/StGallen/NewYearsDayTest.php +++ b/tests/Switzerland/StGallen/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends StGallenBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/StGallen/PentecostMondayTest.php b/tests/Switzerland/StGallen/PentecostMondayTest.php index 7ca42ecfe..b942a2d33 100644 --- a/tests/Switzerland/StGallen/PentecostMondayTest.php +++ b/tests/Switzerland/StGallen/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/StGallen/StGallenTest.php b/tests/Switzerland/StGallen/StGallenTest.php index 2e12d67f9..b6ac5a699 100644 --- a/tests/Switzerland/StGallen/StGallenTest.php +++ b/tests/Switzerland/StGallen/StGallenTest.php @@ -37,7 +37,7 @@ class StGallenTest extends StGallenBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -103,7 +103,21 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'allSaintsDay', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/StGallen/StStephensDayTest.php b/tests/Switzerland/StGallen/StStephensDayTest.php index c7fabc077..e3ea5f4ae 100644 --- a/tests/Switzerland/StGallen/StStephensDayTest.php +++ b/tests/Switzerland/StGallen/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends StGallenBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/SwissNationalDayTest.php b/tests/Switzerland/SwissNationalDayTest.php index 0ad03a653..d306d2063 100644 --- a/tests/Switzerland/SwissNationalDayTest.php +++ b/tests/Switzerland/SwissNationalDayTest.php @@ -52,7 +52,7 @@ class SwissNationalDayTest extends SwitzerlandBaseTestCase implements HolidayTes */ public function testNationalDayOnAfter1994(): void { - $year = $this->generateRandomYear(self::NATIONAL_ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::NATIONAL_ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -68,7 +68,7 @@ public function testNationalDayOnAfter1994(): void */ public function testNationalDayOnAfter1899(): void { - $year = $this->generateRandomYear(self::FIRST_ESTABLISHMENT_YEAR, self::NATIONAL_ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(self::FIRST_ESTABLISHMENT_YEAR, self::NATIONAL_ESTABLISHMENT_YEAR - 1); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -105,7 +105,7 @@ public function testNationalDayBefore1891(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::FIRST_OBSERVANCE_YEAR - 1) + static::generateRandomYear(1000, self::FIRST_OBSERVANCE_YEAR - 1) ); } @@ -116,7 +116,7 @@ public function testNationalDayBefore1891(): void */ public function testNationalDayBetween1891And1899(): void { - $year = $this->generateRandomYear(self::FIRST_OBSERVANCE_YEAR + 1, self::FIRST_ESTABLISHMENT_YEAR - 1); + $year = static::generateRandomYear(self::FIRST_OBSERVANCE_YEAR + 1, self::FIRST_ESTABLISHMENT_YEAR - 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -130,7 +130,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::NATIONAL_ESTABLISHMENT_YEAR), + static::generateRandomYear(self::NATIONAL_ESTABLISHMENT_YEAR), [self::LOCALE => 'Bundesfeiertag'] ); } @@ -145,7 +145,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::NATIONAL_ESTABLISHMENT_YEAR), + static::generateRandomYear(self::NATIONAL_ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Switzerland/SwitzerlandTest.php b/tests/Switzerland/SwitzerlandTest.php index 033526988..f9cbfbccd 100644 --- a/tests/Switzerland/SwitzerlandTest.php +++ b/tests/Switzerland/SwitzerlandTest.php @@ -37,7 +37,7 @@ class SwitzerlandTest extends SwitzerlandBaseTestCase implements ProviderTestCas */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** diff --git a/tests/Switzerland/Thurgau/AscensionDayTest.php b/tests/Switzerland/Thurgau/AscensionDayTest.php index 18f669e5d..353865f76 100644 --- a/tests/Switzerland/Thurgau/AscensionDayTest.php +++ b/tests/Switzerland/Thurgau/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Thurgau/BerchtoldsTagTest.php b/tests/Switzerland/Thurgau/BerchtoldsTagTest.php index 723363693..a947a13a1 100644 --- a/tests/Switzerland/Thurgau/BerchtoldsTagTest.php +++ b/tests/Switzerland/Thurgau/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends ThurgauBaseTestCase implements HolidayTestCase */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Berchtoldstag'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Thurgau/ChristmasDayTest.php b/tests/Switzerland/Thurgau/ChristmasDayTest.php index a33416b9c..da918cadd 100644 --- a/tests/Switzerland/Thurgau/ChristmasDayTest.php +++ b/tests/Switzerland/Thurgau/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends ThurgauBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Thurgau/EasterMondayTest.php b/tests/Switzerland/Thurgau/EasterMondayTest.php index ff8eb71f2..a836510fe 100644 --- a/tests/Switzerland/Thurgau/EasterMondayTest.php +++ b/tests/Switzerland/Thurgau/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Thurgau/GoodFridayTest.php b/tests/Switzerland/Thurgau/GoodFridayTest.php index 1747b901d..b32d65efc 100644 --- a/tests/Switzerland/Thurgau/GoodFridayTest.php +++ b/tests/Switzerland/Thurgau/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Thurgau/NewYearsDayTest.php b/tests/Switzerland/Thurgau/NewYearsDayTest.php index db1a7882d..fc7792dd6 100644 --- a/tests/Switzerland/Thurgau/NewYearsDayTest.php +++ b/tests/Switzerland/Thurgau/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends ThurgauBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Thurgau/PentecostMondayTest.php b/tests/Switzerland/Thurgau/PentecostMondayTest.php index 815512f29..d9f3609c1 100644 --- a/tests/Switzerland/Thurgau/PentecostMondayTest.php +++ b/tests/Switzerland/Thurgau/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Thurgau/StStephensDayTest.php b/tests/Switzerland/Thurgau/StStephensDayTest.php index fc2df5c49..d6b6ce9cb 100644 --- a/tests/Switzerland/Thurgau/StStephensDayTest.php +++ b/tests/Switzerland/Thurgau/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends ThurgauBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Thurgau/ThurgauTest.php b/tests/Switzerland/Thurgau/ThurgauTest.php index ab5f0ab8f..948ec16b7 100644 --- a/tests/Switzerland/Thurgau/ThurgauTest.php +++ b/tests/Switzerland/Thurgau/ThurgauTest.php @@ -37,7 +37,7 @@ class ThurgauTest extends ThurgauBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -104,7 +104,22 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'easterMonday', + 'internationalWorkersDay', + 'ascensionDay', + 'pentecostMonday', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Thurgau/WorkersDayTest.php b/tests/Switzerland/Thurgau/WorkersDayTest.php index a018474e9..e81fc28ff 100644 --- a/tests/Switzerland/Thurgau/WorkersDayTest.php +++ b/tests/Switzerland/Thurgau/WorkersDayTest.php @@ -33,13 +33,12 @@ class WorkersDayTest extends ThurgauBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -53,12 +52,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-5-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -76,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Tag der Arbeit'] ); } @@ -88,6 +87,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/AllSaintsDayTest.php b/tests/Switzerland/Ticino/AllSaintsDayTest.php index 4ce18bd7c..fb780940d 100644 --- a/tests/Switzerland/Ticino/AllSaintsDayTest.php +++ b/tests/Switzerland/Ticino/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends TicinoBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ognissanti'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Ticino/AscensionDayTest.php b/tests/Switzerland/Ticino/AscensionDayTest.php index ba11c4e25..aea3c5600 100644 --- a/tests/Switzerland/Ticino/AscensionDayTest.php +++ b/tests/Switzerland/Ticino/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ascensione'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/AssumptionOfMaryTest.php b/tests/Switzerland/Ticino/AssumptionOfMaryTest.php index 20f6d7ed5..696213f2c 100644 --- a/tests/Switzerland/Ticino/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Ticino/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends TicinoBaseTestCase implements HolidayTestCase /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Assunzione'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/Ticino/ChristmasDayTest.php b/tests/Switzerland/Ticino/ChristmasDayTest.php index f6c048759..917ff421d 100644 --- a/tests/Switzerland/Ticino/ChristmasDayTest.php +++ b/tests/Switzerland/Ticino/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends TicinoBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Natale'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/CorpusChristiTest.php b/tests/Switzerland/Ticino/CorpusChristiTest.php index 2cfda0b34..12af645cf 100644 --- a/tests/Switzerland/Ticino/CorpusChristiTest.php +++ b/tests/Switzerland/Ticino/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Corpus Domini'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/EasterMondayTest.php b/tests/Switzerland/Ticino/EasterMondayTest.php index b8a0b9062..b9be12cdc 100644 --- a/tests/Switzerland/Ticino/EasterMondayTest.php +++ b/tests/Switzerland/Ticino/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lunedi di Pasqua'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/EpiphanyTest.php b/tests/Switzerland/Ticino/EpiphanyTest.php index 963ff29c7..3b9609881 100644 --- a/tests/Switzerland/Ticino/EpiphanyTest.php +++ b/tests/Switzerland/Ticino/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends TicinoBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Epifania'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/ImmaculateConceptionTest.php b/tests/Switzerland/Ticino/ImmaculateConceptionTest.php index 891f25a0b..b4830d6d9 100644 --- a/tests/Switzerland/Ticino/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Ticino/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends TicinoBaseTestCase implements HolidayTest /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Immacolata Concezione'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/NewYearsDayTest.php b/tests/Switzerland/Ticino/NewYearsDayTest.php index 0fec8e2f7..5afdd249a 100644 --- a/tests/Switzerland/Ticino/NewYearsDayTest.php +++ b/tests/Switzerland/Ticino/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends TicinoBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Capodanno'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Ticino/PentecostMondayTest.php b/tests/Switzerland/Ticino/PentecostMondayTest.php index 4cef858a9..3346bd32a 100644 --- a/tests/Switzerland/Ticino/PentecostMondayTest.php +++ b/tests/Switzerland/Ticino/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lunedi di Pentecoste'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/StJosephDayTest.php b/tests/Switzerland/Ticino/StJosephDayTest.php index 6d880658d..37397f492 100644 --- a/tests/Switzerland/Ticino/StJosephDayTest.php +++ b/tests/Switzerland/Ticino/StJosephDayTest.php @@ -36,11 +36,10 @@ class StJosephDayTest extends TicinoBaseTestCase implements HolidayTestCase /** * Tests St. Joseph's Day. * - * @dataProvider StJosephDayDataProvider - * * @param int $year the year for which St. Joseph's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StJosephDayDataProvider')] public function testStJosephDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,9 +52,9 @@ public function testStJosephDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StJosephDayDataProvider(): array + public static function StJosephDayDataProvider(): array { - return $this->generateRandomDates(3, 19, self::TIMEZONE); + return static::generateRandomDates(3, 19, self::TIMEZONE); } /** @@ -68,7 +67,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'San Giuseppe'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/StPeterPaulTest.php b/tests/Switzerland/Ticino/StPeterPaulTest.php index 35cf05e8e..5d7ffae1d 100644 --- a/tests/Switzerland/Ticino/StPeterPaulTest.php +++ b/tests/Switzerland/Ticino/StPeterPaulTest.php @@ -33,11 +33,10 @@ class StPeterPaulTest extends TicinoBaseTestCase implements HolidayTestCase /** * Tests Feast of Saints Peter and Paul. * - * @dataProvider StPeterPaulDataProvider - * * @param int $year the year for which Feast of Saints Peter and Paul needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StPeterPaulDataProvider')] public function testStPeterPaul(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testStPeterPaul(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StPeterPaulDataProvider(): array + public static function StPeterPaulDataProvider(): array { - return $this->generateRandomDates(6, 29, self::TIMEZONE); + return static::generateRandomDates(6, 29, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Santi Pietro e Paolo'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/StStephensDayTest.php b/tests/Switzerland/Ticino/StStephensDayTest.php index c0b655bbb..8039fc51e 100644 --- a/tests/Switzerland/Ticino/StStephensDayTest.php +++ b/tests/Switzerland/Ticino/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends TicinoBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Santo Stefano'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Ticino/TicinoTest.php b/tests/Switzerland/Ticino/TicinoTest.php index a417de495..92e449f99 100644 --- a/tests/Switzerland/Ticino/TicinoTest.php +++ b/tests/Switzerland/Ticino/TicinoTest.php @@ -37,7 +37,7 @@ class TicinoTest extends TicinoBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -109,7 +109,27 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'epiphany', + 'stJosephsDay', + 'easterMonday', + 'internationalWorkersDay', + 'ascensionDay', + 'pentecostMonday', + 'corpusChristi', + 'stPeterPaul', + 'assumptionOfMary', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Ticino/WorkersDayTest.php b/tests/Switzerland/Ticino/WorkersDayTest.php index 6e5f54eb9..ab935539c 100644 --- a/tests/Switzerland/Ticino/WorkersDayTest.php +++ b/tests/Switzerland/Ticino/WorkersDayTest.php @@ -33,13 +33,12 @@ class WorkersDayTest extends TicinoBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -53,12 +52,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-5-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -76,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Festa dei lavoratori'] ); } @@ -88,6 +87,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/AllSaintsDayTest.php b/tests/Switzerland/Uri/AllSaintsDayTest.php index 03e43e8df..28e281f4e 100644 --- a/tests/Switzerland/Uri/AllSaintsDayTest.php +++ b/tests/Switzerland/Uri/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends UriBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Uri/AscensionDayTest.php b/tests/Switzerland/Uri/AscensionDayTest.php index 8a9624795..ea93292be 100644 --- a/tests/Switzerland/Uri/AscensionDayTest.php +++ b/tests/Switzerland/Uri/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/AssumptionOfMaryTest.php b/tests/Switzerland/Uri/AssumptionOfMaryTest.php index da6e08954..9db396279 100644 --- a/tests/Switzerland/Uri/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Uri/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends UriBaseTestCase implements HolidayTestCase /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Himmelfahrt'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/Uri/ChristmasDayTest.php b/tests/Switzerland/Uri/ChristmasDayTest.php index 30bef6d7a..4d32bcdb9 100644 --- a/tests/Switzerland/Uri/ChristmasDayTest.php +++ b/tests/Switzerland/Uri/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends UriBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/CorpusChristiTest.php b/tests/Switzerland/Uri/CorpusChristiTest.php index a335cb60b..c3da48b4f 100644 --- a/tests/Switzerland/Uri/CorpusChristiTest.php +++ b/tests/Switzerland/Uri/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/EasterMondayTest.php b/tests/Switzerland/Uri/EasterMondayTest.php index e4415792c..f77596a12 100644 --- a/tests/Switzerland/Uri/EasterMondayTest.php +++ b/tests/Switzerland/Uri/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/EpiphanyTest.php b/tests/Switzerland/Uri/EpiphanyTest.php index d134a3b46..acfb6910d 100644 --- a/tests/Switzerland/Uri/EpiphanyTest.php +++ b/tests/Switzerland/Uri/EpiphanyTest.php @@ -33,11 +33,10 @@ class EpiphanyTest extends UriBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 6, self::TIMEZONE); + return static::generateRandomDates(1, 6, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Heilige Drei Könige'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/GoodFridayTest.php b/tests/Switzerland/Uri/GoodFridayTest.php index fe111f3e5..565ccd624 100644 --- a/tests/Switzerland/Uri/GoodFridayTest.php +++ b/tests/Switzerland/Uri/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/ImmaculateConceptionTest.php b/tests/Switzerland/Uri/ImmaculateConceptionTest.php index 7fd5aadd8..d67583e0d 100644 --- a/tests/Switzerland/Uri/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Uri/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends UriBaseTestCase implements HolidayTestCas /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Empfängnis'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/NewYearsDayTest.php b/tests/Switzerland/Uri/NewYearsDayTest.php index 1bc0e7cc6..ae7c13132 100644 --- a/tests/Switzerland/Uri/NewYearsDayTest.php +++ b/tests/Switzerland/Uri/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends UriBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Uri/PentecostMondayTest.php b/tests/Switzerland/Uri/PentecostMondayTest.php index f50ec5311..9461ddd63 100644 --- a/tests/Switzerland/Uri/PentecostMondayTest.php +++ b/tests/Switzerland/Uri/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/StJosephDayTest.php b/tests/Switzerland/Uri/StJosephDayTest.php index 970a5034e..9afa9fab6 100644 --- a/tests/Switzerland/Uri/StJosephDayTest.php +++ b/tests/Switzerland/Uri/StJosephDayTest.php @@ -36,11 +36,10 @@ class StJosephDayTest extends UriBaseTestCase implements HolidayTestCase /** * Tests St. Joseph's Day. * - * @dataProvider StJosephDayDataProvider - * * @param int $year the year for which St. Joseph's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StJosephDayDataProvider')] public function testStJosephDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,9 +52,9 @@ public function testStJosephDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StJosephDayDataProvider(): array + public static function StJosephDayDataProvider(): array { - return $this->generateRandomDates(3, 19, self::TIMEZONE); + return static::generateRandomDates(3, 19, self::TIMEZONE); } /** @@ -68,7 +67,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Josephstag'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/StStephensDayTest.php b/tests/Switzerland/Uri/StStephensDayTest.php index 65f1c9f3d..10a62ac0f 100644 --- a/tests/Switzerland/Uri/StStephensDayTest.php +++ b/tests/Switzerland/Uri/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends UriBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Uri/UriTest.php b/tests/Switzerland/Uri/UriTest.php index 7109b1291..61223abf7 100644 --- a/tests/Switzerland/Uri/UriTest.php +++ b/tests/Switzerland/Uri/UriTest.php @@ -37,7 +37,7 @@ class UriTest extends UriBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -108,7 +108,26 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'epiphany', + 'stJosephsDay', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'corpusChristi', + 'assumptionOfMary', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Valais/AllSaintsDayTest.php b/tests/Switzerland/Valais/AllSaintsDayTest.php index 8505d6ae8..558ffe05b 100644 --- a/tests/Switzerland/Valais/AllSaintsDayTest.php +++ b/tests/Switzerland/Valais/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends ValaisBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Toussaint'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Valais/AscensionDayTest.php b/tests/Switzerland/Valais/AscensionDayTest.php index a2c60bafc..3f265ae6e 100644 --- a/tests/Switzerland/Valais/AscensionDayTest.php +++ b/tests/Switzerland/Valais/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ascension'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Valais/AssumptionOfMaryTest.php b/tests/Switzerland/Valais/AssumptionOfMaryTest.php index 8bc1749eb..7e0287513 100644 --- a/tests/Switzerland/Valais/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Valais/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends ValaisBaseTestCase implements HolidayTestCase /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Assomption'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/Valais/ChristmasDayTest.php b/tests/Switzerland/Valais/ChristmasDayTest.php index f4b2c8a2e..5cf57bb9f 100644 --- a/tests/Switzerland/Valais/ChristmasDayTest.php +++ b/tests/Switzerland/Valais/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends ValaisBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Noël'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Valais/CorpusChristiTest.php b/tests/Switzerland/Valais/CorpusChristiTest.php index a9b131272..9d139e047 100644 --- a/tests/Switzerland/Valais/CorpusChristiTest.php +++ b/tests/Switzerland/Valais/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fête-Dieu'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Valais/ImmaculateConceptionTest.php b/tests/Switzerland/Valais/ImmaculateConceptionTest.php index e73d6a6bb..5ef326320 100644 --- a/tests/Switzerland/Valais/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Valais/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends ValaisBaseTestCase implements HolidayTest /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Immaculée Conception'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Valais/NewYearsDayTest.php b/tests/Switzerland/Valais/NewYearsDayTest.php index 7bf9c9225..9037da167 100644 --- a/tests/Switzerland/Valais/NewYearsDayTest.php +++ b/tests/Switzerland/Valais/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends ValaisBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nouvel An'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Valais/StJosephDayTest.php b/tests/Switzerland/Valais/StJosephDayTest.php index 142d66906..77a84cc0e 100644 --- a/tests/Switzerland/Valais/StJosephDayTest.php +++ b/tests/Switzerland/Valais/StJosephDayTest.php @@ -36,11 +36,10 @@ class StJosephDayTest extends ValaisBaseTestCase implements HolidayTestCase /** * Tests St. Joseph's Day. * - * @dataProvider StJosephDayDataProvider - * * @param int $year the year for which St. Joseph's Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('StJosephDayDataProvider')] public function testStJosephDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,9 +52,9 @@ public function testStJosephDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function StJosephDayDataProvider(): array + public static function StJosephDayDataProvider(): array { - return $this->generateRandomDates(3, 19, self::TIMEZONE); + return static::generateRandomDates(3, 19, self::TIMEZONE); } /** @@ -68,7 +67,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Saint-Joseph'] ); } @@ -80,6 +79,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Valais/ValaisTest.php b/tests/Switzerland/Valais/ValaisTest.php index 3d020159f..fd1b5ca80 100644 --- a/tests/Switzerland/Valais/ValaisTest.php +++ b/tests/Switzerland/Valais/ValaisTest.php @@ -37,7 +37,7 @@ class ValaisTest extends ValaisBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -103,7 +103,21 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'stJosephsDay', + 'ascensionDay', + 'corpusChristi', + 'assumptionOfMary', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Vaud/AscensionDayTest.php b/tests/Switzerland/Vaud/AscensionDayTest.php index 4b74bb6da..fe45b7d2c 100644 --- a/tests/Switzerland/Vaud/AscensionDayTest.php +++ b/tests/Switzerland/Vaud/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ascension'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Vaud/BerchtoldsTagTest.php b/tests/Switzerland/Vaud/BerchtoldsTagTest.php index e57b317fc..f8782f4b7 100644 --- a/tests/Switzerland/Vaud/BerchtoldsTagTest.php +++ b/tests/Switzerland/Vaud/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends VaudBaseTestCase implements HolidayTestCase */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Jour de la Saint-Berthold'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Vaud/BettagsMontagTest.php b/tests/Switzerland/Vaud/BettagsMontagTest.php index 83a80a545..50f21141a 100644 --- a/tests/Switzerland/Vaud/BettagsMontagTest.php +++ b/tests/Switzerland/Vaud/BettagsMontagTest.php @@ -37,7 +37,7 @@ class BettagsMontagTest extends VaudBaseTestCase implements HolidayTestCase */ public function testBettagsMontagOnAfter1832(): void { - $year = $this->generateRandomYear(1832); + $year = static::generateRandomYear(1832); // Find third Sunday of September $date = new \DateTime('Third Sunday of ' . $year . '-09', new \DateTimeZone(self::TIMEZONE)); @@ -54,7 +54,7 @@ public function testBettagsMontagOnAfter1832(): void */ public function testBettagsMontagBefore1832(): void { - $year = $this->generateRandomYear(1000, 1831); + $year = static::generateRandomYear(1000, 1831); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -68,7 +68,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1832), + static::generateRandomYear(1832), [self::LOCALE => 'Jeûne fédéral'] ); } @@ -80,6 +80,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1900), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(1900), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Vaud/ChristmasDayTest.php b/tests/Switzerland/Vaud/ChristmasDayTest.php index 860ef7fa9..4544b24c5 100644 --- a/tests/Switzerland/Vaud/ChristmasDayTest.php +++ b/tests/Switzerland/Vaud/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends VaudBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Noël'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Vaud/EasterMondayTest.php b/tests/Switzerland/Vaud/EasterMondayTest.php index e0de0d97c..315854d5a 100644 --- a/tests/Switzerland/Vaud/EasterMondayTest.php +++ b/tests/Switzerland/Vaud/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pâques'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Vaud/GoodFridayTest.php b/tests/Switzerland/Vaud/GoodFridayTest.php index 33945dbc1..da34d7834 100644 --- a/tests/Switzerland/Vaud/GoodFridayTest.php +++ b/tests/Switzerland/Vaud/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Vendredi Saint'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Vaud/NewYearsDayTest.php b/tests/Switzerland/Vaud/NewYearsDayTest.php index a38cb2f07..e37a0b45e 100644 --- a/tests/Switzerland/Vaud/NewYearsDayTest.php +++ b/tests/Switzerland/Vaud/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends VaudBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Nouvel An'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Vaud/PentecostMondayTest.php b/tests/Switzerland/Vaud/PentecostMondayTest.php index cc076e860..76866875d 100644 --- a/tests/Switzerland/Vaud/PentecostMondayTest.php +++ b/tests/Switzerland/Vaud/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Lundi de Pentecôte'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Vaud/VaudTest.php b/tests/Switzerland/Vaud/VaudTest.php index 5774ad5ff..c2456f903 100644 --- a/tests/Switzerland/Vaud/VaudTest.php +++ b/tests/Switzerland/Vaud/VaudTest.php @@ -37,7 +37,7 @@ class VaudTest extends VaudBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -103,7 +103,21 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'bettagsMontag', + 'christmasDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Zug/AllSaintsDayTest.php b/tests/Switzerland/Zug/AllSaintsDayTest.php index 981350b42..ef451414b 100644 --- a/tests/Switzerland/Zug/AllSaintsDayTest.php +++ b/tests/Switzerland/Zug/AllSaintsDayTest.php @@ -33,11 +33,10 @@ class AllSaintsDayTest extends ZugBaseTestCase implements HolidayTestCase /** * Tests All Saints' Day. * - * @dataProvider AllSaintsDayDataProvider - * * @param int $year the year for which All Saints' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AllSaintsDayDataProvider')] public function testAllSaintsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Allerheiligen'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AllSaintsDayDataProvider(): array + public static function AllSaintsDayDataProvider(): array { - return $this->generateRandomDates(11, 1, self::TIMEZONE); + return static::generateRandomDates(11, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Zug/AscensionDayTest.php b/tests/Switzerland/Zug/AscensionDayTest.php index 8f345d441..94a260a5e 100644 --- a/tests/Switzerland/Zug/AscensionDayTest.php +++ b/tests/Switzerland/Zug/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zug/AssumptionOfMaryTest.php b/tests/Switzerland/Zug/AssumptionOfMaryTest.php index 6cd622291..f5d2d358c 100644 --- a/tests/Switzerland/Zug/AssumptionOfMaryTest.php +++ b/tests/Switzerland/Zug/AssumptionOfMaryTest.php @@ -33,11 +33,10 @@ class AssumptionOfMaryTest extends ZugBaseTestCase implements HolidayTestCase /** * Tests the day of the Assumption of Mary. * - * @dataProvider AssumptionOfMaryDataProvider - * * @param int $year the year for which the day of the Assumption of Mary needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('AssumptionOfMaryDataProvider')] public function testAssumptionOfMary(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Himmelfahrt'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function AssumptionOfMaryDataProvider(): array + public static function AssumptionOfMaryDataProvider(): array { - return $this->generateRandomDates(8, 15, self::TIMEZONE); + return static::generateRandomDates(8, 15, self::TIMEZONE); } } diff --git a/tests/Switzerland/Zug/BerchtoldsTagTest.php b/tests/Switzerland/Zug/BerchtoldsTagTest.php index 76978368e..1b5b69a88 100644 --- a/tests/Switzerland/Zug/BerchtoldsTagTest.php +++ b/tests/Switzerland/Zug/BerchtoldsTagTest.php @@ -37,7 +37,7 @@ class BerchtoldsTagTest extends ZugBaseTestCase implements HolidayTestCase */ public function testBerchtoldsTag(): void { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime($year . '-01-02', new \DateTimeZone(self::TIMEZONE)); $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date); @@ -54,7 +54,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Berchtoldstag'] ); } @@ -66,6 +66,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zug/ChristmasDayTest.php b/tests/Switzerland/Zug/ChristmasDayTest.php index 4644f36b9..4a05226dc 100644 --- a/tests/Switzerland/Zug/ChristmasDayTest.php +++ b/tests/Switzerland/Zug/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends ZugBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zug/CorpusChristiTest.php b/tests/Switzerland/Zug/CorpusChristiTest.php index 0e3712b49..a0c648ee7 100644 --- a/tests/Switzerland/Zug/CorpusChristiTest.php +++ b/tests/Switzerland/Zug/CorpusChristiTest.php @@ -45,7 +45,7 @@ public function testCorpusChristi(): void self::REGION, self::HOLIDAY, $year, - $this->calculateEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) + static::computeEaster($year, self::TIMEZONE)->add(new \DateInterval('P60D')) ); } @@ -59,7 +59,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Fronleichnam'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zug/EasterMondayTest.php b/tests/Switzerland/Zug/EasterMondayTest.php index d8af29a28..494e8ae41 100644 --- a/tests/Switzerland/Zug/EasterMondayTest.php +++ b/tests/Switzerland/Zug/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zug/GoodFridayTest.php b/tests/Switzerland/Zug/GoodFridayTest.php index a7bc2afb0..b4b5f8d1a 100644 --- a/tests/Switzerland/Zug/GoodFridayTest.php +++ b/tests/Switzerland/Zug/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zug/ImmaculateConceptionTest.php b/tests/Switzerland/Zug/ImmaculateConceptionTest.php index 46f91b6bf..e8a49be85 100644 --- a/tests/Switzerland/Zug/ImmaculateConceptionTest.php +++ b/tests/Switzerland/Zug/ImmaculateConceptionTest.php @@ -33,11 +33,10 @@ class ImmaculateConceptionTest extends ZugBaseTestCase implements HolidayTestCas /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 8, self::TIMEZONE); + return static::generateRandomDates(12, 8, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mariä Empfängnis'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zug/NewYearsDayTest.php b/tests/Switzerland/Zug/NewYearsDayTest.php index 94b56f992..f8fdb9014 100644 --- a/tests/Switzerland/Zug/NewYearsDayTest.php +++ b/tests/Switzerland/Zug/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends ZugBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Zug/PentecostMondayTest.php b/tests/Switzerland/Zug/PentecostMondayTest.php index ecaef9656..277525ffc 100644 --- a/tests/Switzerland/Zug/PentecostMondayTest.php +++ b/tests/Switzerland/Zug/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zug/StStephensDayTest.php b/tests/Switzerland/Zug/StStephensDayTest.php index 27f5e29e6..d02d73979 100644 --- a/tests/Switzerland/Zug/StStephensDayTest.php +++ b/tests/Switzerland/Zug/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends ZugBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zug/ZugTest.php b/tests/Switzerland/Zug/ZugTest.php index d8d0dbbd2..18cb177e5 100644 --- a/tests/Switzerland/Zug/ZugTest.php +++ b/tests/Switzerland/Zug/ZugTest.php @@ -37,7 +37,7 @@ class ZugTest extends ZugBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -107,7 +107,25 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'berchtoldsTag', + 'goodFriday', + 'easterMonday', + 'ascensionDay', + 'pentecostMonday', + 'corpusChristi', + 'assumptionOfMary', + 'allSaintsDay', + 'immaculateConception', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Switzerland/Zurich/AscensionDayTest.php b/tests/Switzerland/Zurich/AscensionDayTest.php index e75c50900..1baaf7b7d 100644 --- a/tests/Switzerland/Zurich/AscensionDayTest.php +++ b/tests/Switzerland/Zurich/AscensionDayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Auffahrt'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zurich/ChristmasDayTest.php b/tests/Switzerland/Zurich/ChristmasDayTest.php index 0eb49d037..24c4a3eee 100644 --- a/tests/Switzerland/Zurich/ChristmasDayTest.php +++ b/tests/Switzerland/Zurich/ChristmasDayTest.php @@ -33,11 +33,10 @@ class ChristmasDayTest extends ZurichBaseTestCase implements HolidayTestCase /** * Tests Christmas Day. * - * @dataProvider ChristmasDayDataProvider - * * @param int $year the year for which Christmas Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('ChristmasDayDataProvider')] public function testChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testChristmasDay(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function ChristmasDayDataProvider(): array + public static function ChristmasDayDataProvider(): array { - return $this->generateRandomDates(12, 25, self::TIMEZONE); + return static::generateRandomDates(12, 25, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Weihnachtstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zurich/EasterMondayTest.php b/tests/Switzerland/Zurich/EasterMondayTest.php index 825154d8f..14b76915c 100644 --- a/tests/Switzerland/Zurich/EasterMondayTest.php +++ b/tests/Switzerland/Zurich/EasterMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Ostermontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zurich/GoodFridayTest.php b/tests/Switzerland/Zurich/GoodFridayTest.php index fc0c485be..a38be3ed4 100644 --- a/tests/Switzerland/Zurich/GoodFridayTest.php +++ b/tests/Switzerland/Zurich/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Karfreitag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zurich/NewYearsDayTest.php b/tests/Switzerland/Zurich/NewYearsDayTest.php index 620f1f22c..546aa6b47 100644 --- a/tests/Switzerland/Zurich/NewYearsDayTest.php +++ b/tests/Switzerland/Zurich/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends ZurichBaseTestCase implements HolidayTestCase /** * Tests New Years Day. * - * @dataProvider NewYearsDayDataProvider - * * @param int $year the year for which New Years Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('NewYearsDayDataProvider')] public function testNewYearsDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Neujahr'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function NewYearsDayDataProvider(): array + public static function NewYearsDayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } } diff --git a/tests/Switzerland/Zurich/PentecostMondayTest.php b/tests/Switzerland/Zurich/PentecostMondayTest.php index 62f225e16..8acf77c8e 100644 --- a/tests/Switzerland/Zurich/PentecostMondayTest.php +++ b/tests/Switzerland/Zurich/PentecostMondayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Pfingstmontag'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zurich/StStephensDayTest.php b/tests/Switzerland/Zurich/StStephensDayTest.php index 419350f13..c3a7d18a6 100644 --- a/tests/Switzerland/Zurich/StStephensDayTest.php +++ b/tests/Switzerland/Zurich/StStephensDayTest.php @@ -33,11 +33,10 @@ class StStephensDayTest extends ZurichBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(12, 26, self::TIMEZONE); + return static::generateRandomDates(12, 26, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Stephanstag'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zurich/WorkersDayTest.php b/tests/Switzerland/Zurich/WorkersDayTest.php index a29f45a5b..6a7e47716 100644 --- a/tests/Switzerland/Zurich/WorkersDayTest.php +++ b/tests/Switzerland/Zurich/WorkersDayTest.php @@ -33,13 +33,12 @@ class WorkersDayTest extends ZurichBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -53,12 +52,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-5-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -76,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Tag der Arbeit'] ); } @@ -88,6 +87,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OTHER); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OTHER); } } diff --git a/tests/Switzerland/Zurich/ZurichTest.php b/tests/Switzerland/Zurich/ZurichTest.php index ebcf5225f..4d3ffe526 100644 --- a/tests/Switzerland/Zurich/ZurichTest.php +++ b/tests/Switzerland/Zurich/ZurichTest.php @@ -37,7 +37,7 @@ class ZurichTest extends ZurichBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1945); + $this->year = static::generateRandomYear(1945); } /** @@ -103,7 +103,21 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'newYearsDay', + 'goodFriday', + 'easterMonday', + 'internationalWorkersDay', + 'ascensionDay', + 'pentecostMonday', + 'christmasDay', + 'stStephensDay', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Turkey/CommemorationOfAtaturkTest.php b/tests/Turkey/CommemorationOfAtaturkTest.php index 1be93d74f..394cc60a7 100644 --- a/tests/Turkey/CommemorationOfAtaturkTest.php +++ b/tests/Turkey/CommemorationOfAtaturkTest.php @@ -35,7 +35,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) ); } @@ -44,7 +44,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Atatürk’ü Anma, Gençlik ve Spor Bayramı'] ); } @@ -71,6 +71,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Turkey/DemocracyDayTest.php b/tests/Turkey/DemocracyDayTest.php index 72d9f0e34..b60131bd6 100644 --- a/tests/Turkey/DemocracyDayTest.php +++ b/tests/Turkey/DemocracyDayTest.php @@ -32,7 +32,7 @@ class DemocracyDayTest extends TurkeyBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, @@ -50,7 +50,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) ); } @@ -62,7 +62,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Demokrasi ve Millî Birlik Günü'] ); } @@ -75,7 +75,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Turkey/LabourDayTest.php b/tests/Turkey/LabourDayTest.php index 679fed015..ea52715c4 100644 --- a/tests/Turkey/LabourDayTest.php +++ b/tests/Turkey/LabourDayTest.php @@ -25,11 +25,10 @@ class LabourDayTest extends TurkeyBaseTestCase implements HolidayTestCase public const HOLIDAY = 'labourDay'; /** - * @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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -43,7 +42,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Emek ve Dayanışma Günü'] ); } @@ -56,7 +55,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OFFICIAL ); } @@ -66,8 +65,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Turkey/NationalSovereigntyDayTest.php b/tests/Turkey/NationalSovereigntyDayTest.php index 799b8ee6c..728efae56 100644 --- a/tests/Turkey/NationalSovereigntyDayTest.php +++ b/tests/Turkey/NationalSovereigntyDayTest.php @@ -39,7 +39,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) ); } @@ -48,7 +48,7 @@ public function testHolidayBeforeEstablishment(): void */ public function testHolidayOnAfterEstablishment(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -65,7 +65,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::NAME_CHANGED_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::NAME_CHANGED_YEAR - 1), [self::LOCALE => 'Ulusal Egemenlik Bayramı'] ); } @@ -78,7 +78,7 @@ public function testTranslationOnAfterNameChange(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::NAME_CHANGED_YEAR), + static::generateRandomYear(self::NAME_CHANGED_YEAR), [self::LOCALE => 'Ulusal Egemenlik ve Çocuk Bayramı'] ); } @@ -88,6 +88,6 @@ public function testTranslationOnAfterNameChange(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Turkey/NewYearsDayTest.php b/tests/Turkey/NewYearsDayTest.php index 619092cac..ce64006c1 100644 --- a/tests/Turkey/NewYearsDayTest.php +++ b/tests/Turkey/NewYearsDayTest.php @@ -25,11 +25,10 @@ class NewYearsDayTest extends TurkeyBaseTestCase implements HolidayTestCase public const HOLIDAY = 'newYearsDay'; /** - * @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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -40,9 +39,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Yılbaşı'] ); } @@ -63,6 +62,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Turkey/RepublicDayTest.php b/tests/Turkey/RepublicDayTest.php index 0781ac68c..afdde07d8 100644 --- a/tests/Turkey/RepublicDayTest.php +++ b/tests/Turkey/RepublicDayTest.php @@ -32,7 +32,7 @@ class RepublicDayTest extends TurkeyBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, @@ -50,7 +50,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::ESTABLISHMENT_YEAR - 1) ); } @@ -62,7 +62,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Cumhuriyet Bayramı'] ); } @@ -75,7 +75,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Turkey/TurkeyTest.php b/tests/Turkey/TurkeyTest.php index 69a157462..83deafecd 100644 --- a/tests/Turkey/TurkeyTest.php +++ b/tests/Turkey/TurkeyTest.php @@ -32,7 +32,7 @@ class TurkeyTest extends TurkeyBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(); + $this->year = static::generateRandomYear(); } public function testOfficialHolidays(): void diff --git a/tests/Turkey/VictoryDayTest.php b/tests/Turkey/VictoryDayTest.php index 90962c4bb..0e66d914f 100644 --- a/tests/Turkey/VictoryDayTest.php +++ b/tests/Turkey/VictoryDayTest.php @@ -34,7 +34,7 @@ class VictoryDayTest extends TurkeyBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(self::CELEBRATION_YEAR); + $year = static::generateRandomYear(self::CELEBRATION_YEAR); $this->assertHoliday( self::REGION, @@ -52,7 +52,7 @@ public function testHolidayBeforeCelebration(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::CELEBRATION_YEAR - 1) + static::generateRandomYear(Yasumi::YEAR_LOWER_BOUND, self::CELEBRATION_YEAR - 1) ); } @@ -64,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::CELEBRATION_YEAR), + static::generateRandomYear(self::CELEBRATION_YEAR), [self::LOCALE => 'Zafer Bayramı'] ); } @@ -77,7 +77,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } @@ -90,7 +90,7 @@ public function testHolidayTypeBeforeEstablishment(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::CELEBRATION_YEAR, self::ESTABLISHMENT_YEAR - 1), + static::generateRandomYear(self::CELEBRATION_YEAR, self::ESTABLISHMENT_YEAR - 1), Holiday::TYPE_OBSERVANCE ); } diff --git a/tests/USA/ChristmasDayTest.php b/tests/USA/ChristmasDayTest.php index ee433edc9..0e9341653 100644 --- a/tests/USA/ChristmasDayTest.php +++ b/tests/USA/ChristmasDayTest.php @@ -90,7 +90,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas'] ); } @@ -102,6 +102,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/USA/ColumbusDayTest.php b/tests/USA/ColumbusDayTest.php index b298257a6..c548ae521 100644 --- a/tests/USA/ColumbusDayTest.php +++ b/tests/USA/ColumbusDayTest.php @@ -43,7 +43,7 @@ class ColumbusDayTest extends USABaseTestCase implements HolidayTestCase */ public function testColumbusDayOnAfter1970(): void { - $year = $this->generateRandomYear(1970); + $year = static::generateRandomYear(1970); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -60,7 +60,7 @@ public function testColumbusDayOnAfter1970(): void */ public function testColumbusBetween1937And1969(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1969); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1969); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -80,7 +80,7 @@ public function testColumbusDayBefore1937(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -94,7 +94,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Columbus Day'] ); } @@ -109,7 +109,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/USA/IndependenceDayTest.php b/tests/USA/IndependenceDayTest.php index fbfd5a013..fb203bcea 100644 --- a/tests/USA/IndependenceDayTest.php +++ b/tests/USA/IndependenceDayTest.php @@ -93,7 +93,7 @@ public function testIndependenceDayBefore1776(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -107,7 +107,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Independence Day'] ); } @@ -122,7 +122,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/USA/JuneteenthTest.php b/tests/USA/JuneteenthTest.php index 250fa5072..a7f2e0997 100644 --- a/tests/USA/JuneteenthTest.php +++ b/tests/USA/JuneteenthTest.php @@ -93,7 +93,7 @@ public function testJuneteenthBefore2021(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -107,7 +107,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Juneteenth'] ); } @@ -122,7 +122,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/USA/LabourDayTest.php b/tests/USA/LabourDayTest.php index 3f2b442fd..87f519f46 100644 --- a/tests/USA/LabourDayTest.php +++ b/tests/USA/LabourDayTest.php @@ -42,7 +42,7 @@ class LabourDayTest extends USABaseTestCase implements HolidayTestCase */ public function testLabourDayOnAfter1887(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testLabourDayBefore1887(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Labor Day'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/USA/MartinLutherKingDayTest.php b/tests/USA/MartinLutherKingDayTest.php index a9154259f..7791e013f 100644 --- a/tests/USA/MartinLutherKingDayTest.php +++ b/tests/USA/MartinLutherKingDayTest.php @@ -43,7 +43,7 @@ class MartinLutherKingDayTest extends USABaseTestCase implements HolidayTestCase */ public function testMartinLutherKingDayOnAfter1986(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testMartinLutherKingDayBefore1986(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -77,7 +77,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Dr. Martin Luther King Jr’s Birthday'] ); } @@ -92,7 +92,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/USA/MemorialDayTest.php b/tests/USA/MemorialDayTest.php index e2aa847f9..0f01420ea 100644 --- a/tests/USA/MemorialDayTest.php +++ b/tests/USA/MemorialDayTest.php @@ -43,7 +43,7 @@ class MemorialDayTest extends USABaseTestCase implements HolidayTestCase */ public function testMemorialDayOnAfter1968(): void { - $year = $this->generateRandomYear(1968); + $year = static::generateRandomYear(1968); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -60,7 +60,7 @@ public function testMemorialDayOnAfter1968(): void */ public function testMemorialDayBetween1865And1967(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1967); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1967); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -80,7 +80,7 @@ public function testMemorialDayBefore1865(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -94,7 +94,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Memorial Day'] ); } @@ -109,7 +109,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/USA/NYSE/NYSETest.php b/tests/USA/NYSE/NYSETest.php index 07e874ea0..e222a9c1c 100644 --- a/tests/USA/NYSE/NYSETest.php +++ b/tests/USA/NYSE/NYSETest.php @@ -45,7 +45,7 @@ class NYSETest extends USABaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(2000); + $this->year = static::generateRandomYear(2000); } /** @@ -66,10 +66,10 @@ public function testOfficialHolidays(): void ]; if (2001 === $this->year) { - $holidays[] = 'WTCAttack1'; - $holidays[] = 'WTCAttack2'; - $holidays[] = 'WTCAttack3'; - $holidays[] = 'WTCAttack4'; + $holidays[] = 'groundZero1'; + $holidays[] = 'groundZero2'; + $holidays[] = 'groundZero3'; + $holidays[] = 'groundZero4'; } if (2004 === $this->year) { @@ -89,11 +89,11 @@ public function testOfficialHolidays(): void $holidays[] = 'HWBushMourning'; } - if (2021 > $this->year) { + if (2021 < $this->year) { $holidays[] = 'juneteenth'; } - if (2025 > $this->year) { + if (2025 === $this->year) { $holidays[] = 'CarterMourning'; } diff --git a/tests/USA/NewYearsDayTest.php b/tests/USA/NewYearsDayTest.php index 766eedd3b..d6900631e 100644 --- a/tests/USA/NewYearsDayTest.php +++ b/tests/USA/NewYearsDayTest.php @@ -89,7 +89,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'New Year’s Day'] ); } @@ -101,6 +101,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/USA/ThanksgivingDayTest.php b/tests/USA/ThanksgivingDayTest.php index e81539af8..5cb67c3d3 100644 --- a/tests/USA/ThanksgivingDayTest.php +++ b/tests/USA/ThanksgivingDayTest.php @@ -43,7 +43,7 @@ class ThanksgivingDayTest extends USABaseTestCase implements HolidayTestCase */ public function testThanksgivingDayOnAfter1863(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testThanksgivingDayBefore1863(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -77,7 +77,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Thanksgiving Day'] ); } @@ -92,7 +92,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/USA/USATest.php b/tests/USA/USATest.php index ffbed18ff..eb6e63bff 100644 --- a/tests/USA/USATest.php +++ b/tests/USA/USATest.php @@ -37,7 +37,7 @@ class USATest extends USABaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1986); + $this->year = static::generateRandomYear(1986); } /** diff --git a/tests/USA/VeteransDayTest.php b/tests/USA/VeteransDayTest.php index c74f60991..24690804b 100644 --- a/tests/USA/VeteransDayTest.php +++ b/tests/USA/VeteransDayTest.php @@ -44,7 +44,7 @@ class VeteransDayTest extends USABaseTestCase implements HolidayTestCase */ public function testVeteransDayOnAfter1919(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -95,7 +95,7 @@ public function testVeteransDayBefore1919(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -107,7 +107,7 @@ public function testVeteransDayBefore1919(): void public function testVeteransDayNameBefore1954(): void { try { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1953); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1953); $holidays = Yasumi::create(self::REGION, $year); $holiday = $holidays->getHoliday(self::HOLIDAY); @@ -125,7 +125,7 @@ public function testVeteransDayNameBefore1954(): void public function testVeteransDayNameAfter1954(): void { try { - $year = $this->generateRandomYear(1954); + $year = static::generateRandomYear(1954); $holidays = Yasumi::create(self::REGION, $year); $holiday = $holidays->getHoliday(self::HOLIDAY); @@ -145,7 +145,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1954), + static::generateRandomYear(1954), [self::LOCALE => 'Veterans Day'] ); } @@ -160,7 +160,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/USA/WashingtonsBirthdayTest.php b/tests/USA/WashingtonsBirthdayTest.php index a0d0f6b32..e59fe3c46 100644 --- a/tests/USA/WashingtonsBirthdayTest.php +++ b/tests/USA/WashingtonsBirthdayTest.php @@ -43,7 +43,7 @@ class WashingtonsBirthdayTest extends USABaseTestCase implements HolidayTestCase */ public function testWashingtonsBirthdayOnAfter1968(): void { - $year = $this->generateRandomYear(1968); + $year = static::generateRandomYear(1968); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -60,7 +60,7 @@ public function testWashingtonsBirthdayOnAfter1968(): void */ public function testWashingtonsBirthdayBetween1879And1967(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1967); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1967); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -80,7 +80,7 @@ public function testWashingtonsBirthdayBefore1879(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -94,7 +94,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Washington’s Birthday'] ); } @@ -109,7 +109,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL ); } diff --git a/tests/Ukraine/CatholicChristmasDayTest.php b/tests/Ukraine/CatholicChristmasDayTest.php index 293bd03d0..4f8d8ad90 100644 --- a/tests/Ukraine/CatholicChristmasDayTest.php +++ b/tests/Ukraine/CatholicChristmasDayTest.php @@ -34,11 +34,10 @@ class CatholicChristmasDayTest extends UkraineBaseTestCase implements HolidayTes /** * Tests Catholic Christmas Day. * - * @dataProvider CatholicChristmasDayDataProvider - * * @param int $year the year for which International Workers' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('CatholicChristmasDayDataProvider')] public function testCatholicChristmasDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -51,7 +50,7 @@ public function testCatholicChristmasDay(int $year, \DateTimeInterface $expected */ public function testNoCatholicChristmasDayBefore2017(): void { - $year = $this->generateRandomYear(null, 2016); + $year = static::generateRandomYear(null, 2016); $holidays = Yasumi::create(self::REGION, $year); $holiday = $holidays->getHoliday(self::HOLIDAY); @@ -70,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(2017), + static::generateRandomYear(2017), [self::LOCALE => 'Католицький день Різдва'] ); } @@ -82,7 +81,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(2017), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(2017), Holiday::TYPE_OFFICIAL); } /** @@ -92,12 +91,12 @@ public function testHolidayType(): void * * @throws \Exception */ - public function CatholicChristmasDayDataProvider(): array + public static function CatholicChristmasDayDataProvider(): array { $data = []; for ($y = 0; $y < 10; ++$y) { - $year = $this->generateRandomYear(2017); + $year = static::generateRandomYear(2017); $data[] = [$year, new \DateTime("{$year}-12-25", new \DateTimeZone(self::TIMEZONE))]; } diff --git a/tests/Ukraine/ChristmasDayTest.php b/tests/Ukraine/ChristmasDayTest.php index 3a83a840b..46d1496e7 100644 --- a/tests/Ukraine/ChristmasDayTest.php +++ b/tests/Ukraine/ChristmasDayTest.php @@ -37,7 +37,7 @@ class ChristmasDayTest extends UkraineBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(1000, self::ABOLISHMENT_YEAR); + $year = static::generateRandomYear(1000, self::ABOLISHMENT_YEAR); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -51,7 +51,7 @@ public function testHoliday(): void */ public function testNotHolidayAfter2023(): void { - $year = $this->generateRandomYear(self::ABOLISHMENT_YEAR + 1); + $year = static::generateRandomYear(self::ABOLISHMENT_YEAR + 1); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -63,7 +63,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, 2023), + static::generateRandomYear(1000, 2023), [self::LOCALE => 'Різдво'] ); } @@ -75,6 +75,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(1000, 2023), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(1000, 2023), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Ukraine/ConstitutionDayTest.php b/tests/Ukraine/ConstitutionDayTest.php index 5f1c18024..243515f20 100644 --- a/tests/Ukraine/ConstitutionDayTest.php +++ b/tests/Ukraine/ConstitutionDayTest.php @@ -35,7 +35,7 @@ class ConstitutionDayTest extends UkraineBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(2024); + $year = static::generateRandomYear(2024); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -49,7 +49,7 @@ public function testHoliday(): void */ public function testHolidayBefore2024(): void { - $year = $this->generateRandomYear(1996, 2023); + $year = static::generateRandomYear(1996, 2023); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testHolidayBefore2024(): void */ public function testNotHolidayBeforeEstablishment(): void { - $year = $this->generateRandomYear(1000, 1995); + $year = static::generateRandomYear(1000, 1995); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } diff --git a/tests/Ukraine/DefenderOfUkraineDayTest.php b/tests/Ukraine/DefenderOfUkraineDayTest.php index 59d34dc21..809485d85 100644 --- a/tests/Ukraine/DefenderOfUkraineDayTest.php +++ b/tests/Ukraine/DefenderOfUkraineDayTest.php @@ -35,7 +35,7 @@ class DefenderOfUkraineDayTest extends UkraineBaseTestCase implements HolidayTes */ public function testHoliday(): void { - $year = $this->generateRandomYear(2023); + $year = static::generateRandomYear(2023); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -49,7 +49,7 @@ public function testHoliday(): void */ public function testHolidayBefore2023(): void { - $year = $this->generateRandomYear(2015, 2022); + $year = static::generateRandomYear(2015, 2022); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testHolidayBefore2023(): void */ public function testNotHolidayBeforeEstablishment(): void { - $year = $this->generateRandomYear(1000, 2014); + $year = static::generateRandomYear(1000, 2014); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } diff --git a/tests/Ukraine/EasterTest.php b/tests/Ukraine/EasterTest.php index 9dd3f02d5..d59ca93d5 100644 --- a/tests/Ukraine/EasterTest.php +++ b/tests/Ukraine/EasterTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Великдень'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Ukraine/InternationalWomensDayTest.php b/tests/Ukraine/InternationalWomensDayTest.php index f0b7961e0..1cbb10b13 100644 --- a/tests/Ukraine/InternationalWomensDayTest.php +++ b/tests/Ukraine/InternationalWomensDayTest.php @@ -30,9 +30,7 @@ class InternationalWomensDayTest extends UkraineBaseTestCase implements HolidayT */ public const HOLIDAY = 'internationalWomensDay'; - /** - * @dataProvider HolidayDataProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -45,9 +43,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(3, 8, self::TIMEZONE); + return static::generateRandomDates(3, 8, self::TIMEZONE); } /** @@ -60,7 +58,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Міжнародний жіночий день'] ); } @@ -72,6 +70,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Ukraine/InternationalWorkersDayTest.php b/tests/Ukraine/InternationalWorkersDayTest.php index 4f84ab7eb..fe84d1ce4 100644 --- a/tests/Ukraine/InternationalWorkersDayTest.php +++ b/tests/Ukraine/InternationalWorkersDayTest.php @@ -33,11 +33,10 @@ class InternationalWorkersDayTest extends UkraineBaseTestCase implements Holiday /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('InternationalWorkersDayDataProvider')] public function testInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -53,7 +52,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'День міжнародної солідарності трудящих'] ); } @@ -65,7 +64,7 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } /** @@ -75,8 +74,8 @@ public function testHolidayType(): void * * @throws \Exception */ - public function InternationalWorkersDayDataProvider(): array + public static function InternationalWorkersDayDataProvider(): array { - return $this->generateRandomDates(5, 1, self::TIMEZONE); + return static::generateRandomDates(5, 1, self::TIMEZONE); } } diff --git a/tests/Ukraine/NewYearsDayTest.php b/tests/Ukraine/NewYearsDayTest.php index 4b335ca67..d28431801 100644 --- a/tests/Ukraine/NewYearsDayTest.php +++ b/tests/Ukraine/NewYearsDayTest.php @@ -33,11 +33,10 @@ class NewYearsDayTest extends UkraineBaseTestCase implements HolidayTestCase /** * 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 */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -50,9 +49,9 @@ public function testHoliday(int $year, \DateTimeInterface $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDates(1, 1, self::TIMEZONE); + return static::generateRandomDates(1, 1, self::TIMEZONE); } /** @@ -65,7 +64,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Новий Рік'] ); } @@ -77,6 +76,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Ukraine/PentecostTest.php b/tests/Ukraine/PentecostTest.php index b1d5bee36..4da8fc0fc 100644 --- a/tests/Ukraine/PentecostTest.php +++ b/tests/Ukraine/PentecostTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Трійця'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/Ukraine/SecondInternationalWorkersDayTest.php b/tests/Ukraine/SecondInternationalWorkersDayTest.php index 8e5352cc5..8cfdd66f4 100644 --- a/tests/Ukraine/SecondInternationalWorkersDayTest.php +++ b/tests/Ukraine/SecondInternationalWorkersDayTest.php @@ -34,11 +34,10 @@ class SecondInternationalWorkersDayTest extends UkraineBaseTestCase implements H /** * Tests International Workers' Day. * - * @dataProvider SecondInternationalWorkersDayDataProvider - * * @param int $year the year for which International Workers' Day needs to be tested * @param \DateTime $expected the expected date */ + #[\PHPUnit\Framework\Attributes\DataProvider('SecondInternationalWorkersDayDataProvider')] public function testSecondInternationalWorkersDay(int $year, \DateTimeInterface $expected): void { $this->assertHoliday(self::REGION, self::HOLIDAY, $year, $expected); @@ -51,7 +50,7 @@ public function testSecondInternationalWorkersDay(int $year, \DateTimeInterface */ public function testNoSecondInternationalWorkersDaySince2018(): void { - $year = $this->generateRandomYear(2018); + $year = static::generateRandomYear(2018); $holidays = Yasumi::create(self::REGION, $year); $holiday = $holidays->getHoliday(self::HOLIDAY); @@ -70,7 +69,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(null, 2017), + static::generateRandomYear(null, 2017), [self::LOCALE => 'День міжнародної солідарності трудящих'] ); } @@ -85,7 +84,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(null, 2017), + static::generateRandomYear(null, 2017), Holiday::TYPE_OFFICIAL ); } @@ -97,12 +96,12 @@ public function testHolidayType(): void * * @throws \Exception */ - public function SecondInternationalWorkersDayDataProvider(): array + public static function SecondInternationalWorkersDayDataProvider(): array { $data = []; for ($y = 0; $y < 10; ++$y) { - $year = $this->generateRandomYear(null, 2017); + $year = static::generateRandomYear(null, 2017); $data[] = [$year, new \DateTime("{$year}-05-02", new \DateTimeZone(self::TIMEZONE))]; } diff --git a/tests/Ukraine/UkraineTest.php b/tests/Ukraine/UkraineTest.php index 33fee6455..8ef788acc 100644 --- a/tests/Ukraine/UkraineTest.php +++ b/tests/Ukraine/UkraineTest.php @@ -37,7 +37,7 @@ class UkraineTest extends UkraineBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(); + $this->year = static::generateRandomYear(); } /** diff --git a/tests/Ukraine/VictoryDayTest.php b/tests/Ukraine/VictoryDayTest.php index bf9f62858..0b0959d89 100644 --- a/tests/Ukraine/VictoryDayTest.php +++ b/tests/Ukraine/VictoryDayTest.php @@ -35,7 +35,7 @@ class VictoryDayTest extends UkraineBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(2024); + $year = static::generateRandomYear(2024); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -49,7 +49,7 @@ public function testHoliday(): void */ public function testHolidayBefore2024(): void { - $year = $this->generateRandomYear(2015, 2023); + $year = static::generateRandomYear(2015, 2023); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testHolidayBefore2024(): void */ public function testNotHolidayBeforeEstablishment(): void { - $year = $this->generateRandomYear(1000, 2014); + $year = static::generateRandomYear(1000, 2014); $this->assertNotHoliday(self::REGION, self::HOLIDAY, $year); } @@ -77,7 +77,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(2015), + static::generateRandomYear(2015), [self::LOCALE => 'День перемоги'] ); } @@ -89,6 +89,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(2015), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(2015), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/UnitedKingdom/BoxingDayTest.php b/tests/UnitedKingdom/BoxingDayTest.php index 83eb507e6..adfd6a2ad 100644 --- a/tests/UnitedKingdom/BoxingDayTest.php +++ b/tests/UnitedKingdom/BoxingDayTest.php @@ -33,13 +33,12 @@ class BoxingDayTest extends UnitedKingdomBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -59,12 +58,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-26", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -83,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Boxing Day'] ); } @@ -95,6 +94,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/UnitedKingdom/ChristmasDayTest.php b/tests/UnitedKingdom/ChristmasDayTest.php index 44cf8f0fc..3e1060d15 100644 --- a/tests/UnitedKingdom/ChristmasDayTest.php +++ b/tests/UnitedKingdom/ChristmasDayTest.php @@ -33,13 +33,12 @@ class ChristmasDayTest extends UnitedKingdomBaseTestCase implements HolidayTestC /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -59,12 +58,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-25", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -83,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); } @@ -95,6 +94,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/UnitedKingdom/England/BoxingDayTest.php b/tests/UnitedKingdom/England/BoxingDayTest.php index b498b4a37..cc5436672 100644 --- a/tests/UnitedKingdom/England/BoxingDayTest.php +++ b/tests/UnitedKingdom/England/BoxingDayTest.php @@ -33,13 +33,12 @@ class BoxingDayTest extends EnglandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -59,12 +58,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-26", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -83,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Boxing Day'] ); } @@ -95,6 +94,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/UnitedKingdom/England/ChristmasDayTest.php b/tests/UnitedKingdom/England/ChristmasDayTest.php index 3d89c8a8f..cf08a4d75 100644 --- a/tests/UnitedKingdom/England/ChristmasDayTest.php +++ b/tests/UnitedKingdom/England/ChristmasDayTest.php @@ -33,13 +33,12 @@ class ChristmasDayTest extends EnglandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -59,12 +58,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-25", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -83,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); } @@ -95,6 +94,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/UnitedKingdom/England/EasterMondayTest.php b/tests/UnitedKingdom/England/EasterMondayTest.php index fae27137f..6f8a5ee17 100644 --- a/tests/UnitedKingdom/England/EasterMondayTest.php +++ b/tests/UnitedKingdom/England/EasterMondayTest.php @@ -33,13 +33,12 @@ class EasterMondayTest extends EnglandBaseTestCase implements HolidayTestCase /** * Tests Easter Monday. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->add(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Monday'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/UnitedKingdom/England/EnglandTest.php b/tests/UnitedKingdom/England/EnglandTest.php index da3eae536..33e28336b 100644 --- a/tests/UnitedKingdom/England/EnglandTest.php +++ b/tests/UnitedKingdom/England/EnglandTest.php @@ -37,7 +37,7 @@ class EnglandTest extends EnglandBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** @@ -77,17 +77,17 @@ public function testBankHolidays(): void 'secondChristmasDay', ]; - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); - if (1965 >= $this->year) { + if (1965 <= $year) { $holidays[] = 'springBankHoliday'; } - if (1974 > $this->year) { + if (1974 <= $year) { $holidays[] = 'newYearsDay'; } - if (1978 >= $this->year) { + if (1978 <= $year) { $holidays[] = 'mayDayBankHoliday'; } @@ -107,7 +107,14 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'motheringSunday', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** @@ -116,6 +123,6 @@ public function testOtherHolidays(): void */ public function testSources(): void { - $this->assertSources(self::REGION, 1); + $this->assertSources(self::REGION, 2); } } diff --git a/tests/UnitedKingdom/England/GoodFridayTest.php b/tests/UnitedKingdom/England/GoodFridayTest.php index 9dfbfbe74..dd530353d 100644 --- a/tests/UnitedKingdom/England/GoodFridayTest.php +++ b/tests/UnitedKingdom/England/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Good Friday'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/UnitedKingdom/England/MayDayBankHolidayTest.php b/tests/UnitedKingdom/England/MayDayBankHolidayTest.php index 70b4fa5f7..4b1b85075 100644 --- a/tests/UnitedKingdom/England/MayDayBankHolidayTest.php +++ b/tests/UnitedKingdom/England/MayDayBankHolidayTest.php @@ -83,7 +83,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -97,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'May Day Bank Holiday'] ); } @@ -112,7 +112,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/England/NewYearsDayTest.php b/tests/UnitedKingdom/England/NewYearsDayTest.php index 311373840..6cb0db022 100644 --- a/tests/UnitedKingdom/England/NewYearsDayTest.php +++ b/tests/UnitedKingdom/England/NewYearsDayTest.php @@ -43,13 +43,12 @@ class NewYearsDayTest extends EnglandBaseTestCase implements HolidayTestCase /** * Tests the holiday defined in this test on or after establishment. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHolidayOnAfterEstablishment(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -84,7 +83,7 @@ public function testHolidayIsObservedTypeBeforeChange(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), Holiday::TYPE_OBSERVANCE ); } @@ -96,9 +95,9 @@ public function testHolidayIsObservedTypeBeforeChange(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDatesWithHolidayMovedToMonday(01, 01, self::TIMEZONE, 10, self::ESTABLISHMENT_YEAR); + return static::generateRandomDatesWithHolidayMovedToMonday(01, 01, self::TIMEZONE, 10, self::ESTABLISHMENT_YEAR); } /** @@ -111,7 +110,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'New Year’s Day'] ); } @@ -126,7 +125,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ADJUSTMENT_YEAR + 1), + static::generateRandomYear(self::ADJUSTMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/England/SpringBankHolidayTest.php b/tests/UnitedKingdom/England/SpringBankHolidayTest.php index 5cced237e..c46763feb 100644 --- a/tests/UnitedKingdom/England/SpringBankHolidayTest.php +++ b/tests/UnitedKingdom/England/SpringBankHolidayTest.php @@ -83,7 +83,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -97,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Spring Bank Holiday'] ); } @@ -112,7 +112,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/England/SummerBankHolidayTest.php b/tests/UnitedKingdom/England/SummerBankHolidayTest.php index 5e080857f..1a11de9c1 100644 --- a/tests/UnitedKingdom/England/SummerBankHolidayTest.php +++ b/tests/UnitedKingdom/England/SummerBankHolidayTest.php @@ -47,7 +47,7 @@ class SummerBankHolidayTest extends EnglandBaseTestCase implements HolidayTestCa */ public function testHoliday(): void { - $year = $this->generateRandomYear(1970); + $year = static::generateRandomYear(1970); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testHoliday(): void */ public function testHolidayBefore1965(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1964); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1964); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -127,7 +127,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -141,7 +141,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::RENAME_YEAR), + static::generateRandomYear(self::RENAME_YEAR), [self::LOCALE => 'Summer Bank Holiday'] ); } @@ -156,7 +156,7 @@ public function testTranslationBeforeRename(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::RENAME_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::RENAME_YEAR - 1), [self::LOCALE => 'August Bank Holiday'] ); } @@ -171,7 +171,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/GoodFridayTest.php b/tests/UnitedKingdom/GoodFridayTest.php index 462752d96..72987520f 100644 --- a/tests/UnitedKingdom/GoodFridayTest.php +++ b/tests/UnitedKingdom/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Good Friday'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/UnitedKingdom/KingCharlesCoronationBankHolidayTest.php b/tests/UnitedKingdom/KingCharlesCoronationBankHolidayTest.php index f1ab55b82..3b02184dd 100644 --- a/tests/UnitedKingdom/KingCharlesCoronationBankHolidayTest.php +++ b/tests/UnitedKingdom/KingCharlesCoronationBankHolidayTest.php @@ -65,7 +65,7 @@ public function testHolidayBeforeActive(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ACTIVE_YEAR - 1) + static::generateRandomYear(1000, self::ACTIVE_YEAR - 1) ); } @@ -79,7 +79,7 @@ public function testHolidayAfterActive(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ACTIVE_YEAR + 1) + static::generateRandomYear(self::ACTIVE_YEAR + 1) ); } diff --git a/tests/UnitedKingdom/MayDayBankHolidayTest.php b/tests/UnitedKingdom/MayDayBankHolidayTest.php index 80cc2c17c..3746a1537 100644 --- a/tests/UnitedKingdom/MayDayBankHolidayTest.php +++ b/tests/UnitedKingdom/MayDayBankHolidayTest.php @@ -83,7 +83,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -97,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'May Day Bank Holiday'] ); } @@ -112,7 +112,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/MotheringSundayTest.php b/tests/UnitedKingdom/MotheringSundayTest.php index ed89dddd1..4ae81d075 100644 --- a/tests/UnitedKingdom/MotheringSundayTest.php +++ b/tests/UnitedKingdom/MotheringSundayTest.php @@ -26,10 +26,9 @@ class MotheringSundayTest extends EnglandBaseTestCase implements HolidayTestCase public const HOLIDAY = 'motheringSunday'; /** - * @dataProvider HolidayDataProvider - * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -45,13 +44,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->sub(new \DateInterval('P3W')); $data[] = [$year, $date->format('Y-m-d')]; @@ -72,7 +71,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Mothering Sunday'] ); } @@ -85,7 +84,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), Holiday::TYPE_OTHER ); } diff --git a/tests/UnitedKingdom/NewYearsDayTest.php b/tests/UnitedKingdom/NewYearsDayTest.php index 0b13e7152..1efe44830 100644 --- a/tests/UnitedKingdom/NewYearsDayTest.php +++ b/tests/UnitedKingdom/NewYearsDayTest.php @@ -43,13 +43,12 @@ class NewYearsDayTest extends UnitedKingdomBaseTestCase implements HolidayTestCa /** * Tests the holiday defined in this test on or after establishment. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHolidayOnAfterEstablishment(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -84,7 +83,7 @@ public function testHolidayIsObservedTypeBeforeChange(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), Holiday::TYPE_OBSERVANCE ); } @@ -96,9 +95,9 @@ public function testHolidayIsObservedTypeBeforeChange(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDatesWithHolidayMovedToMonday(01, 01, self::TIMEZONE, 10, self::ESTABLISHMENT_YEAR); + return static::generateRandomDatesWithHolidayMovedToMonday(01, 01, self::TIMEZONE, 10, self::ESTABLISHMENT_YEAR); } /** @@ -111,7 +110,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'New Year’s Day'] ); } @@ -126,7 +125,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ADJUSTMENT_YEAR + 1), + static::generateRandomYear(self::ADJUSTMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/NorthernIreland/BattleOfTheBoyneTest.php b/tests/UnitedKingdom/NorthernIreland/BattleOfTheBoyneTest.php index 28857f430..446f86a00 100644 --- a/tests/UnitedKingdom/NorthernIreland/BattleOfTheBoyneTest.php +++ b/tests/UnitedKingdom/NorthernIreland/BattleOfTheBoyneTest.php @@ -38,13 +38,12 @@ class BattleOfTheBoyneTest extends NorthernIrelandBaseTestCase implements Holida /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -66,7 +65,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -77,12 +76,12 @@ public function testHolidayBeforeEstablishment(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-7-12", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -100,7 +99,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Battle of the Boyne'] ); } @@ -115,7 +114,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/NorthernIreland/BoxingDayTest.php b/tests/UnitedKingdom/NorthernIreland/BoxingDayTest.php index ed033fd1e..fc56f8669 100644 --- a/tests/UnitedKingdom/NorthernIreland/BoxingDayTest.php +++ b/tests/UnitedKingdom/NorthernIreland/BoxingDayTest.php @@ -33,13 +33,12 @@ class BoxingDayTest extends NorthernIrelandBaseTestCase implements HolidayTestCa /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -59,12 +58,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-26", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -83,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Boxing Day'] ); } @@ -95,6 +94,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/UnitedKingdom/NorthernIreland/ChristmasDayTest.php b/tests/UnitedKingdom/NorthernIreland/ChristmasDayTest.php index 0be2c83e5..31f69a4dd 100644 --- a/tests/UnitedKingdom/NorthernIreland/ChristmasDayTest.php +++ b/tests/UnitedKingdom/NorthernIreland/ChristmasDayTest.php @@ -33,13 +33,12 @@ class ChristmasDayTest extends NorthernIrelandBaseTestCase implements HolidayTes /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -59,12 +58,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-25", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -83,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); } @@ -95,6 +94,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/UnitedKingdom/NorthernIreland/EasterMondayTest.php b/tests/UnitedKingdom/NorthernIreland/EasterMondayTest.php index d4275c79b..9ce46db08 100644 --- a/tests/UnitedKingdom/NorthernIreland/EasterMondayTest.php +++ b/tests/UnitedKingdom/NorthernIreland/EasterMondayTest.php @@ -33,13 +33,12 @@ class EasterMondayTest extends NorthernIrelandBaseTestCase implements HolidayTes /** * Tests Easter Monday. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->add(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Monday'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/UnitedKingdom/NorthernIreland/GoodFridayTest.php b/tests/UnitedKingdom/NorthernIreland/GoodFridayTest.php index e45c86e57..d72435185 100644 --- a/tests/UnitedKingdom/NorthernIreland/GoodFridayTest.php +++ b/tests/UnitedKingdom/NorthernIreland/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Good Friday'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/UnitedKingdom/NorthernIreland/MayDayBankHolidayTest.php b/tests/UnitedKingdom/NorthernIreland/MayDayBankHolidayTest.php index de13c1d89..985d45051 100644 --- a/tests/UnitedKingdom/NorthernIreland/MayDayBankHolidayTest.php +++ b/tests/UnitedKingdom/NorthernIreland/MayDayBankHolidayTest.php @@ -83,7 +83,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -97,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'May Day Bank Holiday'] ); } @@ -112,7 +112,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/NorthernIreland/NewYearsDayTest.php b/tests/UnitedKingdom/NorthernIreland/NewYearsDayTest.php index 0bf274cb3..009c85ab0 100644 --- a/tests/UnitedKingdom/NorthernIreland/NewYearsDayTest.php +++ b/tests/UnitedKingdom/NorthernIreland/NewYearsDayTest.php @@ -43,13 +43,12 @@ class NewYearsDayTest extends NorthernIrelandBaseTestCase implements HolidayTest /** * Tests the holiday defined in this test on or after establishment. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHolidayOnAfterEstablishment(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -84,7 +83,7 @@ public function testHolidayIsObservedTypeBeforeChange(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), Holiday::TYPE_OBSERVANCE ); } @@ -96,9 +95,9 @@ public function testHolidayIsObservedTypeBeforeChange(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDatesWithHolidayMovedToMonday(01, 01, self::TIMEZONE, 10, self::ESTABLISHMENT_YEAR); + return static::generateRandomDatesWithHolidayMovedToMonday(01, 01, self::TIMEZONE, 10, self::ESTABLISHMENT_YEAR); } /** @@ -111,7 +110,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'New Year’s Day'] ); } @@ -126,7 +125,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ADJUSTMENT_YEAR + 1), + static::generateRandomYear(self::ADJUSTMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/NorthernIreland/NorthernIrelandTest.php b/tests/UnitedKingdom/NorthernIreland/NorthernIrelandTest.php index e10d634fe..1c60072de 100644 --- a/tests/UnitedKingdom/NorthernIreland/NorthernIrelandTest.php +++ b/tests/UnitedKingdom/NorthernIreland/NorthernIrelandTest.php @@ -37,7 +37,7 @@ class NorthernIrelandTest extends NorthernIrelandBaseTestCase implements Provide */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** @@ -77,21 +77,21 @@ public function testBankHolidays(): void 'secondChristmasDay', ]; - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); - if (1926 >= $this->year) { + if (1926 <= $year) { $holidays[] = 'battleOfTheBoyne'; } - if (1965 >= $this->year) { + if (1965 <= $year) { $holidays[] = 'springBankHoliday'; } - if (1974 > $this->year) { + if (1974 <= $year) { $holidays[] = 'newYearsDay'; } - if (1978 >= $this->year) { + if (1978 <= $year) { $holidays[] = 'mayDayBankHoliday'; } @@ -111,7 +111,14 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'motheringSunday', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/UnitedKingdom/NorthernIreland/SpringBankHolidayTest.php b/tests/UnitedKingdom/NorthernIreland/SpringBankHolidayTest.php index ad9e6adca..25eabf06e 100644 --- a/tests/UnitedKingdom/NorthernIreland/SpringBankHolidayTest.php +++ b/tests/UnitedKingdom/NorthernIreland/SpringBankHolidayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Spring Bank Holiday'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/NorthernIreland/StPatricksDayTest.php b/tests/UnitedKingdom/NorthernIreland/StPatricksDayTest.php index c66b2ab4a..ceb153c7b 100644 --- a/tests/UnitedKingdom/NorthernIreland/StPatricksDayTest.php +++ b/tests/UnitedKingdom/NorthernIreland/StPatricksDayTest.php @@ -38,13 +38,12 @@ class StPatricksDayTest extends NorthernIrelandBaseTestCase implements HolidayTe /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -66,7 +65,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -77,12 +76,12 @@ public function testHolidayBeforeEstablishment(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-3-17", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -100,7 +99,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'St. Patrick’s Day'] ); } @@ -115,7 +114,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/NorthernIreland/SummerBankHolidayTest.php b/tests/UnitedKingdom/NorthernIreland/SummerBankHolidayTest.php index bc978498f..6c19d2115 100644 --- a/tests/UnitedKingdom/NorthernIreland/SummerBankHolidayTest.php +++ b/tests/UnitedKingdom/NorthernIreland/SummerBankHolidayTest.php @@ -47,7 +47,7 @@ class SummerBankHolidayTest extends NorthernIrelandBaseTestCase implements Holid */ public function testHoliday(): void { - $year = $this->generateRandomYear(1970); + $year = static::generateRandomYear(1970); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testHoliday(): void */ public function testHolidayBefore1965(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1964); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1964); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -127,7 +127,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -141,7 +141,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::RENAME_YEAR), + static::generateRandomYear(self::RENAME_YEAR), [self::LOCALE => 'Summer Bank Holiday'] ); } @@ -156,7 +156,7 @@ public function testTranslationBeforeRename(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::RENAME_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::RENAME_YEAR - 1), [self::LOCALE => 'August Bank Holiday'] ); } @@ -171,7 +171,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/PlatinumJubileeBankHolidayTest.php b/tests/UnitedKingdom/PlatinumJubileeBankHolidayTest.php index 341c6ace2..347047441 100644 --- a/tests/UnitedKingdom/PlatinumJubileeBankHolidayTest.php +++ b/tests/UnitedKingdom/PlatinumJubileeBankHolidayTest.php @@ -65,7 +65,7 @@ public function testHolidayBeforeActive(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ACTIVE_YEAR - 1) + static::generateRandomYear(1000, self::ACTIVE_YEAR - 1) ); } @@ -79,7 +79,7 @@ public function testHolidayAfterActive(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ACTIVE_YEAR + 1) + static::generateRandomYear(self::ACTIVE_YEAR + 1) ); } diff --git a/tests/UnitedKingdom/QueenElizabethFuneralBankHolidayTest.php b/tests/UnitedKingdom/QueenElizabethFuneralBankHolidayTest.php index 037d6f4f3..fd2e42870 100644 --- a/tests/UnitedKingdom/QueenElizabethFuneralBankHolidayTest.php +++ b/tests/UnitedKingdom/QueenElizabethFuneralBankHolidayTest.php @@ -65,7 +65,7 @@ public function testHolidayBeforeActive(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ACTIVE_YEAR - 1) + static::generateRandomYear(1000, self::ACTIVE_YEAR - 1) ); } @@ -79,7 +79,7 @@ public function testHolidayAfterActive(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ACTIVE_YEAR + 1) + static::generateRandomYear(self::ACTIVE_YEAR + 1) ); } diff --git a/tests/UnitedKingdom/Scotland/BoxingDayTest.php b/tests/UnitedKingdom/Scotland/BoxingDayTest.php index a3109fa16..da0edd5af 100644 --- a/tests/UnitedKingdom/Scotland/BoxingDayTest.php +++ b/tests/UnitedKingdom/Scotland/BoxingDayTest.php @@ -33,13 +33,12 @@ class BoxingDayTest extends ScotlandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -59,12 +58,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-26", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -83,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Boxing Day'] ); } @@ -95,6 +94,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/UnitedKingdom/Scotland/ChristmasDayTest.php b/tests/UnitedKingdom/Scotland/ChristmasDayTest.php index 72469f051..bc9c2ed4c 100644 --- a/tests/UnitedKingdom/Scotland/ChristmasDayTest.php +++ b/tests/UnitedKingdom/Scotland/ChristmasDayTest.php @@ -33,13 +33,12 @@ class ChristmasDayTest extends ScotlandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -59,12 +58,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-25", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -83,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); } @@ -95,6 +94,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/UnitedKingdom/Scotland/GoodFridayTest.php b/tests/UnitedKingdom/Scotland/GoodFridayTest.php index 104112dd4..e6c510238 100644 --- a/tests/UnitedKingdom/Scotland/GoodFridayTest.php +++ b/tests/UnitedKingdom/Scotland/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Good Friday'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/UnitedKingdom/Scotland/MayDayBankHolidayTest.php b/tests/UnitedKingdom/Scotland/MayDayBankHolidayTest.php index 697df97db..a17d73882 100644 --- a/tests/UnitedKingdom/Scotland/MayDayBankHolidayTest.php +++ b/tests/UnitedKingdom/Scotland/MayDayBankHolidayTest.php @@ -83,7 +83,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -97,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'May Day Bank Holiday'] ); } @@ -112,7 +112,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/Scotland/NewYearsDayTest.php b/tests/UnitedKingdom/Scotland/NewYearsDayTest.php index 4159388ac..b2cc54c42 100644 --- a/tests/UnitedKingdom/Scotland/NewYearsDayTest.php +++ b/tests/UnitedKingdom/Scotland/NewYearsDayTest.php @@ -43,13 +43,12 @@ class NewYearsDayTest extends ScotlandBaseTestCase implements HolidayTestCase /** * Tests the holiday defined in this test on or after establishment. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHolidayOnAfterEstablishment(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -71,7 +70,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -85,7 +84,7 @@ public function testHolidayIsObservedTypeBeforeChange(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), Holiday::TYPE_OBSERVANCE ); } @@ -97,12 +96,12 @@ public function testHolidayIsObservedTypeBeforeChange(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-1-1", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -120,7 +119,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'New Year’s Day'] ); } @@ -135,7 +134,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ADJUSTMENT_YEAR + 1), + static::generateRandomYear(self::ADJUSTMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/Scotland/ScotlandTest.php b/tests/UnitedKingdom/Scotland/ScotlandTest.php index 1a3bfb1db..27262ae00 100644 --- a/tests/UnitedKingdom/Scotland/ScotlandTest.php +++ b/tests/UnitedKingdom/Scotland/ScotlandTest.php @@ -37,7 +37,7 @@ class ScotlandTest extends ScotlandBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** @@ -76,17 +76,17 @@ public function testBankHolidays(): void 'secondChristmasDay', ]; - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); - if (1965 >= $this->year) { + if (1965 <= $year) { $holidays[] = 'springBankHoliday'; } - if (1974 > $this->year) { + if (1974 <= $year) { $holidays[] = 'newYearsDay'; } - if (1978 >= $this->year) { + if (1978 <= $year) { $holidays[] = 'mayDayBankHoliday'; } @@ -106,7 +106,14 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'motheringSunday', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** @@ -115,6 +122,6 @@ public function testOtherHolidays(): void */ public function testSources(): void { - $this->assertSources(self::REGION, 1); + $this->assertSources(self::REGION, 2); } } diff --git a/tests/UnitedKingdom/Scotland/SecondNewYearsDayTest.php b/tests/UnitedKingdom/Scotland/SecondNewYearsDayTest.php index c2e6c60a4..1eb70f4b0 100644 --- a/tests/UnitedKingdom/Scotland/SecondNewYearsDayTest.php +++ b/tests/UnitedKingdom/Scotland/SecondNewYearsDayTest.php @@ -43,13 +43,12 @@ class SecondNewYearsDayTest extends ScotlandBaseTestCase implements HolidayTestC /** * Tests the holiday defined in this test on or after establishment. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHolidayOnAfterEstablishment(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -71,7 +70,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -85,7 +84,7 @@ public function testHolidayIsObservedTypeBeforeChange(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), Holiday::TYPE_OBSERVANCE ); } @@ -97,12 +96,12 @@ public function testHolidayIsObservedTypeBeforeChange(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-1-2", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -120,7 +119,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => '2nd January'] ); } @@ -135,7 +134,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ADJUSTMENT_YEAR + 1), + static::generateRandomYear(self::ADJUSTMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/Scotland/SpringBankHolidayTest.php b/tests/UnitedKingdom/Scotland/SpringBankHolidayTest.php index ff880c3e3..11b683a35 100644 --- a/tests/UnitedKingdom/Scotland/SpringBankHolidayTest.php +++ b/tests/UnitedKingdom/Scotland/SpringBankHolidayTest.php @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Spring Bank Holiday'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/Scotland/StAndrewsDayTest.php b/tests/UnitedKingdom/Scotland/StAndrewsDayTest.php index 18edbe8de..d4d4e507d 100644 --- a/tests/UnitedKingdom/Scotland/StAndrewsDayTest.php +++ b/tests/UnitedKingdom/Scotland/StAndrewsDayTest.php @@ -38,13 +38,12 @@ class StAndrewsDayTest extends ScotlandBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -63,12 +62,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR); $date = new \DateTime("{$year}-11-30", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; } @@ -86,7 +85,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'St. Andrew’s Day'] ); } @@ -101,7 +100,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/Scotland/SummerBankHolidayTest.php b/tests/UnitedKingdom/Scotland/SummerBankHolidayTest.php index e67053276..745855fca 100644 --- a/tests/UnitedKingdom/Scotland/SummerBankHolidayTest.php +++ b/tests/UnitedKingdom/Scotland/SummerBankHolidayTest.php @@ -42,7 +42,7 @@ class SummerBankHolidayTest extends ScotlandBaseTestCase implements HolidayTestC */ public function testHoliday(): void { - $year = $this->generateRandomYear(1970); + $year = static::generateRandomYear(1970); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -61,7 +61,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -75,7 +75,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'August Bank Holiday'] ); } @@ -90,7 +90,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/SpringBankHolidayTest.php b/tests/UnitedKingdom/SpringBankHolidayTest.php index 64d088430..7053009ca 100644 --- a/tests/UnitedKingdom/SpringBankHolidayTest.php +++ b/tests/UnitedKingdom/SpringBankHolidayTest.php @@ -90,7 +90,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -104,7 +104,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Spring Bank Holiday'] ); } @@ -119,7 +119,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/SummerBankHolidayTest.php b/tests/UnitedKingdom/SummerBankHolidayTest.php index e6ad5d958..a7a2b54ba 100644 --- a/tests/UnitedKingdom/SummerBankHolidayTest.php +++ b/tests/UnitedKingdom/SummerBankHolidayTest.php @@ -47,7 +47,7 @@ class SummerBankHolidayTest extends UnitedKingdomBaseTestCase implements Holiday */ public function testHoliday(): void { - $year = $this->generateRandomYear(1970); + $year = static::generateRandomYear(1970); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testHoliday(): void */ public function testHolidayBefore1965(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1964); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1964); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -127,7 +127,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -141,7 +141,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::RENAME_YEAR), + static::generateRandomYear(self::RENAME_YEAR), [self::LOCALE => 'Summer Bank Holiday'] ); } @@ -156,7 +156,7 @@ public function testTranslationBeforeRename(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::RENAME_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::RENAME_YEAR - 1), [self::LOCALE => 'August Bank Holiday'] ); } @@ -171,7 +171,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/UnitedKingdomTest.php b/tests/UnitedKingdom/UnitedKingdomTest.php index 75b5c3454..682d1368e 100644 --- a/tests/UnitedKingdom/UnitedKingdomTest.php +++ b/tests/UnitedKingdom/UnitedKingdomTest.php @@ -37,7 +37,7 @@ class UnitedKingdomTest extends UnitedKingdomBaseTestCase implements ProviderTes */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** @@ -76,17 +76,17 @@ public function testBankHolidays(): void 'secondChristmasDay', ]; - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); - if (1965 >= $this->year) { + if (1965 <= $year) { $holidays[] = 'springBankHoliday'; } - if (1974 > $this->year) { + if (1974 <= $year) { $holidays[] = 'newYearsDay'; } - if (1978 >= $this->year) { + if (1978 <= $year) { $holidays[] = 'mayDayBankHoliday'; } @@ -106,7 +106,14 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'motheringSunday', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** @@ -115,6 +122,6 @@ public function testOtherHolidays(): void */ public function testSources(): void { - $this->assertSources(self::REGION, 1); + $this->assertSources(self::REGION, 2); } } diff --git a/tests/UnitedKingdom/Wales/BoxingDayTest.php b/tests/UnitedKingdom/Wales/BoxingDayTest.php index 7523be445..339918d74 100644 --- a/tests/UnitedKingdom/Wales/BoxingDayTest.php +++ b/tests/UnitedKingdom/Wales/BoxingDayTest.php @@ -33,13 +33,12 @@ class BoxingDayTest extends WalesBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -59,12 +58,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-26", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -83,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Boxing Day'] ); } @@ -95,6 +94,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/UnitedKingdom/Wales/ChristmasDayTest.php b/tests/UnitedKingdom/Wales/ChristmasDayTest.php index 28bf930fd..913d8334e 100644 --- a/tests/UnitedKingdom/Wales/ChristmasDayTest.php +++ b/tests/UnitedKingdom/Wales/ChristmasDayTest.php @@ -33,13 +33,12 @@ class ChristmasDayTest extends WalesBaseTestCase implements HolidayTestCase /** * 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 string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $date = new \DateTime($expected, new \DateTimeZone(self::TIMEZONE)); @@ -59,12 +58,12 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < self::TEST_ITERATIONS; ++$y) { - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); $date = new \DateTime("{$year}-12-25", new \DateTimeZone(self::TIMEZONE)); $data[] = [$year, $date->format('Y-m-d')]; @@ -83,7 +82,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Christmas Day'] ); } @@ -95,6 +94,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/UnitedKingdom/Wales/EasterMondayTest.php b/tests/UnitedKingdom/Wales/EasterMondayTest.php index e7997852d..017d1bddc 100644 --- a/tests/UnitedKingdom/Wales/EasterMondayTest.php +++ b/tests/UnitedKingdom/Wales/EasterMondayTest.php @@ -33,13 +33,12 @@ class EasterMondayTest extends WalesBaseTestCase implements HolidayTestCase /** * Tests Easter Monday. * - * @dataProvider HolidayDataProvider - * * @param int $year the year for which the holiday defined in this test needs to be tested * @param string $expected the expected date * * @throws \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHoliday(int $year, string $expected): void { $this->assertHoliday( @@ -57,13 +56,13 @@ public function testHoliday(int $year, string $expected): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { $data = []; for ($y = 0; $y < 50; ++$y) { - $year = $this->generateRandomYear(); - $date = $this->calculateEaster($year, self::TIMEZONE); + $year = static::generateRandomYear(); + $date = static::computeEaster($year, self::TIMEZONE); $date->add(new \DateInterval('P1D')); $data[] = [$year, $date->format('Y-m-d')]; @@ -82,7 +81,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Easter Monday'] ); } @@ -94,6 +93,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_BANK); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_BANK); } } diff --git a/tests/UnitedKingdom/Wales/GoodFridayTest.php b/tests/UnitedKingdom/Wales/GoodFridayTest.php index 8203825e2..011c65395 100644 --- a/tests/UnitedKingdom/Wales/GoodFridayTest.php +++ b/tests/UnitedKingdom/Wales/GoodFridayTest.php @@ -56,7 +56,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(), + static::generateRandomYear(), [self::LOCALE => 'Good Friday'] ); } @@ -68,6 +68,6 @@ public function testTranslation(): void */ public function testHolidayType(): void { - $this->assertHolidayType(self::REGION, self::HOLIDAY, $this->generateRandomYear(), Holiday::TYPE_OFFICIAL); + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); } } diff --git a/tests/UnitedKingdom/Wales/MayDayBankHolidayTest.php b/tests/UnitedKingdom/Wales/MayDayBankHolidayTest.php index 27ac5b314..d5aa4b817 100644 --- a/tests/UnitedKingdom/Wales/MayDayBankHolidayTest.php +++ b/tests/UnitedKingdom/Wales/MayDayBankHolidayTest.php @@ -83,7 +83,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -97,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'May Day Bank Holiday'] ); } @@ -112,7 +112,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/Wales/NewYearsDayTest.php b/tests/UnitedKingdom/Wales/NewYearsDayTest.php index 522e908d3..4a4644650 100644 --- a/tests/UnitedKingdom/Wales/NewYearsDayTest.php +++ b/tests/UnitedKingdom/Wales/NewYearsDayTest.php @@ -43,13 +43,12 @@ class NewYearsDayTest extends WalesBaseTestCase implements HolidayTestCase /** * Tests the holiday defined in this test on or after establishment. * - * @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 \Exception */ + #[\PHPUnit\Framework\Attributes\DataProvider('HolidayDataProvider')] public function testHolidayOnAfterEstablishment(int $year, string $expected): void { $this->assertHoliday( @@ -70,7 +69,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -84,7 +83,7 @@ public function testHolidayIsObservedTypeBeforeChange(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::ADJUSTMENT_YEAR - 1), Holiday::TYPE_OBSERVANCE ); } @@ -96,9 +95,9 @@ public function testHolidayIsObservedTypeBeforeChange(): void * * @throws \Exception */ - public function HolidayDataProvider(): array + public static function HolidayDataProvider(): array { - return $this->generateRandomDatesWithHolidayMovedToMonday(01, 01, self::TIMEZONE, 10, self::ESTABLISHMENT_YEAR); + return static::generateRandomDatesWithHolidayMovedToMonday(01, 01, self::TIMEZONE, 10, self::ESTABLISHMENT_YEAR); } /** @@ -111,7 +110,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'New Year’s Day'] ); } @@ -126,7 +125,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ADJUSTMENT_YEAR + 1), + static::generateRandomYear(self::ADJUSTMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/Wales/SpringBankHolidayTest.php b/tests/UnitedKingdom/Wales/SpringBankHolidayTest.php index 8b25e8e86..03954edfa 100644 --- a/tests/UnitedKingdom/Wales/SpringBankHolidayTest.php +++ b/tests/UnitedKingdom/Wales/SpringBankHolidayTest.php @@ -83,7 +83,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -97,7 +97,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), [self::LOCALE => 'Spring Bank Holiday'] ); } @@ -112,7 +112,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/Wales/SummerBankHolidayTest.php b/tests/UnitedKingdom/Wales/SummerBankHolidayTest.php index 4a962677a..3c0d9d532 100644 --- a/tests/UnitedKingdom/Wales/SummerBankHolidayTest.php +++ b/tests/UnitedKingdom/Wales/SummerBankHolidayTest.php @@ -47,7 +47,7 @@ class SummerBankHolidayTest extends WalesBaseTestCase implements HolidayTestCase */ public function testHoliday(): void { - $year = $this->generateRandomYear(1970); + $year = static::generateRandomYear(1970); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -63,7 +63,7 @@ public function testHoliday(): void */ public function testHolidayBefore1965(): void { - $year = $this->generateRandomYear(self::ESTABLISHMENT_YEAR, 1964); + $year = static::generateRandomYear(self::ESTABLISHMENT_YEAR, 1964); $this->assertHoliday( self::REGION, self::HOLIDAY, @@ -127,7 +127,7 @@ public function testHolidayBeforeEstablishment(): void $this->assertNotHoliday( self::REGION, self::HOLIDAY, - $this->generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) + static::generateRandomYear(1000, self::ESTABLISHMENT_YEAR - 1) ); } @@ -141,7 +141,7 @@ public function testTranslation(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::RENAME_YEAR), + static::generateRandomYear(self::RENAME_YEAR), [self::LOCALE => 'Summer Bank Holiday'] ); } @@ -156,7 +156,7 @@ public function testTranslationBeforeRename(): void $this->assertTranslatedHolidayName( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR, self::RENAME_YEAR - 1), + static::generateRandomYear(self::ESTABLISHMENT_YEAR, self::RENAME_YEAR - 1), [self::LOCALE => 'August Bank Holiday'] ); } @@ -171,7 +171,7 @@ public function testHolidayType(): void $this->assertHolidayType( self::REGION, self::HOLIDAY, - $this->generateRandomYear(self::ESTABLISHMENT_YEAR), + static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_BANK ); } diff --git a/tests/UnitedKingdom/Wales/WalesTest.php b/tests/UnitedKingdom/Wales/WalesTest.php index f1cbf6e06..533ece322 100644 --- a/tests/UnitedKingdom/Wales/WalesTest.php +++ b/tests/UnitedKingdom/Wales/WalesTest.php @@ -37,7 +37,7 @@ class WalesTest extends WalesBaseTestCase implements ProviderTestCase */ protected function setUp(): void { - $this->year = $this->generateRandomYear(1978); + $this->year = static::generateRandomYear(1978); } /** @@ -77,17 +77,17 @@ public function testBankHolidays(): void 'secondChristmasDay', ]; - $year = $this->generateRandomYear(); + $year = static::generateRandomYear(); - if (1965 >= $this->year) { + if (1965 <= $year) { $holidays[] = 'springBankHoliday'; } - if (1974 > $this->year) { + if (1974 <= $year) { $holidays[] = 'newYearsDay'; } - if (1978 >= $this->year) { + if (1978 <= $year) { $holidays[] = 'mayDayBankHoliday'; } @@ -107,7 +107,14 @@ public function testBankHolidays(): void */ public function testOtherHolidays(): void { - $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + $this->assertDefinedHolidays( + [ + 'motheringSunday', + ], + self::REGION, + $this->year, + Holiday::TYPE_OTHER + ); } /** diff --git a/tests/Venezuela/BattleOfCaraboboDayTest.php b/tests/Venezuela/BattleOfCaraboboDayTest.php new file mode 100755 index 000000000..a46b40ccc --- /dev/null +++ b/tests/Venezuela/BattleOfCaraboboDayTest.php @@ -0,0 +1,68 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\Provider\Venezuela; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Battle of Carabobo Day (24 June) in Venezuela. + * + * Commemorates the decisive battle of 24 June 1821 that secured independence. + */ +class BattleOfCaraboboDayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'battleOfCaraboboDay'; + public const ESTABLISHMENT_YEAR = Venezuela::BATTLE_OF_CARABOBO_YEAR; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = self::ESTABLISHMENT_YEAR; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-06-24", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** @throws \Exception */ + public function testNotHoliday(): void + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, self::ESTABLISHMENT_YEAR - 1); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Batalla de Carabobo'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/BolivarBirthdayDayTest.php b/tests/Venezuela/BolivarBirthdayDayTest.php new file mode 100755 index 000000000..5e3c0b67a --- /dev/null +++ b/tests/Venezuela/BolivarBirthdayDayTest.php @@ -0,0 +1,68 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\Provider\Venezuela; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Simón Bolívar's Birthday (24 July) in Venezuela. + * + * Simón Bolívar was born on 24 July 1783 in Caracas. + */ +class BolivarBirthdayDayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'bolivarBirthdayDay'; + public const ESTABLISHMENT_YEAR = Venezuela::BOLIVAR_BIRTH_YEAR; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = self::ESTABLISHMENT_YEAR; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-07-24", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** @throws \Exception */ + public function testNotHoliday(): void + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, self::ESTABLISHMENT_YEAR - 1); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Natalicio de Simón Bolívar'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/CarnivalMondayTest.php b/tests/Venezuela/CarnivalMondayTest.php new file mode 100755 index 000000000..f06299a6b --- /dev/null +++ b/tests/Venezuela/CarnivalMondayTest.php @@ -0,0 +1,64 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\Provider\ChristianHolidays; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Carnival Monday in Venezuela. + * + * Falls on Easter − 48 days (LOTTT Art. 184(b)). + * 2025: Easter = 20 Apr → Carnival Monday = 3 Mar. + */ +class CarnivalMondayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + use ChristianHolidays; + + public const HOLIDAY = 'carnivalMonday'; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = 2025; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + static::computeEaster($year, self::TIMEZONE)->sub(new \DateInterval('P48D')) + ); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Lunes de Carnaval'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/CarnivalTuesdayTest.php b/tests/Venezuela/CarnivalTuesdayTest.php new file mode 100755 index 000000000..4f5b674bb --- /dev/null +++ b/tests/Venezuela/CarnivalTuesdayTest.php @@ -0,0 +1,64 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\Provider\ChristianHolidays; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Carnival Tuesday in Venezuela. + * + * Falls on Easter − 47 days (LOTTT Art. 184(b)). + * 2025: Easter = 20 Apr → Carnival Tuesday = 4 Mar. + */ +class CarnivalTuesdayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + use ChristianHolidays; + + public const HOLIDAY = 'carnivalTuesday'; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = 2025; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + static::computeEaster($year, self::TIMEZONE)->sub(new \DateInterval('P47D')) + ); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Martes de Carnaval'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/ChristmasDayTest.php b/tests/Venezuela/ChristmasDayTest.php new file mode 100755 index 000000000..5eab68a5b --- /dev/null +++ b/tests/Venezuela/ChristmasDayTest.php @@ -0,0 +1,58 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Christmas Day (Navidad, 25 December) in Venezuela. + */ +class ChristmasDayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'christmasDay'; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = 2025; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-12-25", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Navidad'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/ChristmasEveTest.php b/tests/Venezuela/ChristmasEveTest.php new file mode 100755 index 000000000..76ede2b19 --- /dev/null +++ b/tests/Venezuela/ChristmasEveTest.php @@ -0,0 +1,60 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Christmas Eve (Nochebuena, 24 December) in Venezuela. + * + * Established by LOTTT Art. 184(b). + */ +class ChristmasEveTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'christmasEve'; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = 2025; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-12-24", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Nochebuena'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/DeclarationOfIndependenceDayTest.php b/tests/Venezuela/DeclarationOfIndependenceDayTest.php new file mode 100755 index 000000000..0cb6ec6f2 --- /dev/null +++ b/tests/Venezuela/DeclarationOfIndependenceDayTest.php @@ -0,0 +1,68 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\Provider\Venezuela; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Declaration of Independence Day (19 April) in Venezuela. + * + * Commemorates the Caracas City Council act of 19 April 1810. + */ +class DeclarationOfIndependenceDayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'declarationOfIndependenceDay'; + public const ESTABLISHMENT_YEAR = Venezuela::DECLARATION_OF_INDEPENDENCE_YEAR; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = self::ESTABLISHMENT_YEAR; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-04-19", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** @throws \Exception */ + public function testNotHoliday(): void + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, self::ESTABLISHMENT_YEAR - 1); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Declaración de Independencia'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/GoodFridayTest.php b/tests/Venezuela/GoodFridayTest.php new file mode 100755 index 000000000..a86f2b1b3 --- /dev/null +++ b/tests/Venezuela/GoodFridayTest.php @@ -0,0 +1,61 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\Provider\ChristianHolidays; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Good Friday in Venezuela. + */ +class GoodFridayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + use ChristianHolidays; + + public const HOLIDAY = 'goodFriday'; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = 2025; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + static::computeEaster($year, self::TIMEZONE)->sub(new \DateInterval('P2D')) + ); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Viernes Santo'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/IndependenceDayTest.php b/tests/Venezuela/IndependenceDayTest.php new file mode 100755 index 000000000..d283fc858 --- /dev/null +++ b/tests/Venezuela/IndependenceDayTest.php @@ -0,0 +1,69 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\Provider\Venezuela; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Independence Day (5 July) in Venezuela. + * + * Commemorates the formal Declaration of Independence signed by the + * Venezuelan Congress on 5 July 1811. + */ +class IndependenceDayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'independenceDay'; + public const ESTABLISHMENT_YEAR = Venezuela::INDEPENDENCE_YEAR; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = self::ESTABLISHMENT_YEAR; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-07-05", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** @throws \Exception */ + public function testNotHoliday(): void + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, self::ESTABLISHMENT_YEAR - 1); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(self::ESTABLISHMENT_YEAR), + [self::LOCALE => 'Día de la Independencia'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/IndigenousResistanceDayTest.php b/tests/Venezuela/IndigenousResistanceDayTest.php new file mode 100755 index 000000000..225d07fe9 --- /dev/null +++ b/tests/Venezuela/IndigenousResistanceDayTest.php @@ -0,0 +1,99 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\Provider\Venezuela; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Indigenous Resistance Day / Columbus Day (12 October) in Venezuela. + * + * Known as "Día de la Raza" until 2001. Renamed to "Día de la Resistencia Indígena" + * by Presidential Decree 2028 in 2002. + */ +class IndigenousResistanceDayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'indigenousResistanceDay'; + public const ESTABLISHMENT_YEAR = Venezuela::COLUMBUS_YEAR; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = self::ESTABLISHMENT_YEAR; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-10-12", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** @throws \Exception */ + public function testNotHoliday(): void + { + $this->assertNotHoliday(self::REGION, self::HOLIDAY, self::ESTABLISHMENT_YEAR - 1); + } + + /** + * Tests that the holiday is named "Día de la Raza" before 2002. + * + * @throws \Exception + */ + public function testNameBeforeRename(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + 2001, + [self::LOCALE => 'Día de la Raza'] + ); + } + + /** + * Tests that the holiday is renamed to "Día de la Resistencia Indígena" from 2002 onward. + * + * @throws \Exception + */ + public function testNameAfterRename(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + 2002, + [self::LOCALE => 'Día de la Resistencia Indígena'] + ); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(Venezuela::INDIGENOUS_RESISTANCE_YEAR), + [self::LOCALE => 'Día de la Resistencia Indígena'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(self::ESTABLISHMENT_YEAR), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/InternationalWorkersDayTest.php b/tests/Venezuela/InternationalWorkersDayTest.php new file mode 100755 index 000000000..c3ea83498 --- /dev/null +++ b/tests/Venezuela/InternationalWorkersDayTest.php @@ -0,0 +1,58 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing International Workers' Day in Venezuela. + */ +class InternationalWorkersDayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'internationalWorkersDay'; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = 2025; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-05-01", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Día del Trabajador'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/MaundyThursdayTest.php b/tests/Venezuela/MaundyThursdayTest.php new file mode 100755 index 000000000..95cc1e509 --- /dev/null +++ b/tests/Venezuela/MaundyThursdayTest.php @@ -0,0 +1,61 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\Provider\ChristianHolidays; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing Maundy Thursday in Venezuela. + */ +class MaundyThursdayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + use ChristianHolidays; + + public const HOLIDAY = 'maundyThursday'; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = 2025; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + static::computeEaster($year, self::TIMEZONE)->sub(new \DateInterval('P3D')) + ); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Jueves Santo'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/NewYearsDayTest.php b/tests/Venezuela/NewYearsDayTest.php new file mode 100755 index 000000000..37350c908 --- /dev/null +++ b/tests/Venezuela/NewYearsDayTest.php @@ -0,0 +1,58 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing New Year's Day in Venezuela. + */ +class NewYearsDayTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'newYearsDay'; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = 2025; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-01-01", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Año Nuevo'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/NewYearsEveTest.php b/tests/Venezuela/NewYearsEveTest.php new file mode 100755 index 000000000..44d31281e --- /dev/null +++ b/tests/Venezuela/NewYearsEveTest.php @@ -0,0 +1,60 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\tests\HolidayTestCase; + +/** + * Class for testing New Year's Eve (Víspera de Año Nuevo, 31 December) in Venezuela. + * + * Established by LOTTT Art. 184(b). + */ +class NewYearsEveTest extends VenezuelaBaseTestCase implements HolidayTestCase +{ + public const HOLIDAY = 'newYearsEve'; + + /** @throws \Exception */ + public function testHoliday(): void + { + $year = 2025; + $this->assertHoliday( + self::REGION, + self::HOLIDAY, + $year, + new \DateTime("{$year}-12-31", new \DateTimeZone(self::TIMEZONE)) + ); + } + + /** @throws \Exception */ + public function testTranslation(): void + { + $this->assertTranslatedHolidayName( + self::REGION, + self::HOLIDAY, + static::generateRandomYear(), + [self::LOCALE => 'Víspera de Año Nuevo'] + ); + } + + /** @throws \Exception */ + public function testHolidayType(): void + { + $this->assertHolidayType(self::REGION, self::HOLIDAY, static::generateRandomYear(), Holiday::TYPE_OFFICIAL); + } +} diff --git a/tests/Venezuela/VenezuelaBaseTestCase.php b/tests/Venezuela/VenezuelaBaseTestCase.php new file mode 100755 index 000000000..f9f2d28bd --- /dev/null +++ b/tests/Venezuela/VenezuelaBaseTestCase.php @@ -0,0 +1,38 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use PHPUnit\Framework\TestCase; +use Yasumi\tests\YasumiBase; + +/** + * Base class for Venezuela holiday tests. + */ +abstract class VenezuelaBaseTestCase extends TestCase +{ + use YasumiBase; + + /** Country (name) to be tested. */ + public const REGION = 'Venezuela'; + + /** Timezone in which this provider has holidays defined. */ + public const TIMEZONE = 'America/Caracas'; + + /** Locale that is considered common for this provider. */ + public const LOCALE = 'es'; +} diff --git a/tests/Venezuela/VenezuelaTest.php b/tests/Venezuela/VenezuelaTest.php new file mode 100755 index 000000000..14230d02a --- /dev/null +++ b/tests/Venezuela/VenezuelaTest.php @@ -0,0 +1,111 @@ + + */ + +namespace Yasumi\tests\Venezuela; + +use Yasumi\Holiday; +use Yasumi\Provider\Venezuela; +use Yasumi\tests\ProviderTestCase; + +/** + * Class for testing holidays in Venezuela. + */ +class VenezuelaTest extends VenezuelaBaseTestCase implements ProviderTestCase +{ + /** @var int year random year number used for all tests in this Test Case */ + protected int $year; + + /** + * Initial setup of this Test Case. + * + * @throws \Exception + */ + protected function setUp(): void + { + $this->year = static::generateRandomYear(Venezuela::INDEPENDENCE_YEAR); + } + + /** + * Tests if all official holidays in Venezuela are defined by the provider class. + */ + public function testOfficialHolidays(): void + { + $holidays = [ + 'newYearsDay', + 'carnivalMonday', + 'carnivalTuesday', + 'maundyThursday', + 'goodFriday', + 'internationalWorkersDay', + 'christmasEve', + 'christmasDay', + 'newYearsEve', + ]; + + if ($this->year >= Venezuela::DECLARATION_OF_INDEPENDENCE_YEAR) { + $holidays[] = 'declarationOfIndependenceDay'; + } + + if ($this->year >= Venezuela::BATTLE_OF_CARABOBO_YEAR) { + $holidays[] = 'battleOfCaraboboDay'; + } + + if ($this->year >= Venezuela::INDEPENDENCE_YEAR) { + $holidays[] = 'independenceDay'; + } + + if ($this->year >= Venezuela::BOLIVAR_BIRTH_YEAR) { + $holidays[] = 'bolivarBirthdayDay'; + } + + if ($this->year >= Venezuela::COLUMBUS_YEAR) { + $holidays[] = 'indigenousResistanceDay'; + } + + $this->assertDefinedHolidays($holidays, self::REGION, $this->year, Holiday::TYPE_OFFICIAL); + } + + /** + * Tests if all observed holidays in Venezuela are defined by the provider class. + */ + public function testObservedHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE); + } + + /** + * Tests if all seasonal holidays in Venezuela are defined by the provider class. + */ + public function testSeasonalHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_SEASON); + } + + /** + * Tests if all other holidays in Venezuela are defined by the provider class. + */ + public function testOtherHolidays(): void + { + $this->assertDefinedHolidays([], self::REGION, $this->year, Holiday::TYPE_OTHER); + } + + /** @throws \Exception */ + public function testSources(): void + { + $this->assertSources(self::REGION, 4); + } +} diff --git a/tests/YasumiBase.php b/tests/YasumiBase.php index 21e16faec..3b04b9b5d 100644 --- a/tests/YasumiBase.php +++ b/tests/YasumiBase.php @@ -75,9 +75,18 @@ public function assertDefinedHolidays( break; } + $holidayList = iterator_to_array($holidays); + + if ([] === $expectedHolidays) { + // No holidays to assert; increment count to avoid PHPUnit "no assertions" warning. + $this->addToAssertionCount(1); + + return; + } + // Loop through all known holidays and assert they are defined by the provider class. foreach ($expectedHolidays as $holiday) { - self::assertArrayHasKey($holiday, iterator_to_array($holidays)); + self::assertArrayHasKey($holiday, $holidayList, sprintf('`%s` should exist for year `%u` in the `%s` holiday list for `%s`', $holiday, $year, $type, $provider)); } } @@ -103,9 +112,9 @@ public function assertHoliday( $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday($key); - self::assertInstanceOf(Holiday::class, $holiday); + self::assertInstanceOf(Holiday::class, $holiday, sprintf('No instance holiday for `%s` in year `%u`', $key, $year)); $this->assertDateTime($expected, $holiday); - self::assertTrue($holidays->isHoliday($holiday)); + self::assertTrue($holidays->isHoliday($holiday), sprintf('Holiday `%s` not recognised as holiday for year `%u`', $key, $year)); } /** @@ -130,7 +139,7 @@ public function assertSubstituteHoliday( $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday('substituteHoliday:' . $key); - self::assertInstanceOf(SubstituteHoliday::class, $holiday); + self::assertInstanceOf(SubstituteHoliday::class, $holiday, sprintf('No substitute holiday for `%s` in year `%u`', $key, $year)); $this->assertDateTime($expected, $holiday); self::assertTrue($holidays->isHoliday($holiday)); } @@ -179,7 +188,7 @@ public function assertNotHoliday( $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday($key); - self::assertNull($holiday); + self::assertNull($holiday, sprintf('Holiday `%s` should not exist for year `%u`', $key, $year)); } /** @@ -204,8 +213,8 @@ public function assertTranslatedHolidayName( $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday($key); - self::assertInstanceOf(Holiday::class, $holiday, sprintf('No instance for the year `%u`', $year)); - self::assertTrue($holidays->isHoliday($holiday), sprintf('Holiday `%s` not defined for the year `%u`', $key, $year)); + self::assertInstanceOf(Holiday::class, $holiday, sprintf('No holiday instance for `%s` in year `%u`', $key, $year)); + self::assertTrue($holidays->isHoliday($holiday), sprintf('Holiday `%s` not recognized as holiday for year `%u`', $key, $year)); foreach ($translations as $locale => $name) { $locales = [$locale]; @@ -249,8 +258,8 @@ public function assertHolidayType( $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday($key); - self::assertInstanceOf(Holiday::class, $holiday, sprintf('No instance for the year `%u`', $year)); - self::assertEquals($type, $holiday->getType(), sprintf('Expected type `%s`, got `%s` for the year `%u`', $type, $holiday->getType(), $year)); + self::assertInstanceOf(Holiday::class, $holiday, sprintf('No holiday instance for `%s` in year `%u`', $key, $year)); + self::assertEquals($type, $holiday->getType(), sprintf('Expected type `%s`, got `%s` for year `%u`', $type, $holiday->getType(), $year)); } /** @@ -275,9 +284,9 @@ public function assertDayOfWeek( $holidays = Yasumi::create($provider, $year); $holiday = $holidays->getHoliday($key); - self::assertInstanceOf(Holiday::class, $holiday); - self::assertTrue($holidays->isHoliday($holiday)); - self::assertEquals($expectedDayOfWeek, $holiday->format('l')); + self::assertInstanceOf(Holiday::class, $holiday, sprintf('No holiday instance for key `%s` in year `%us`', $key, $year)); + self::assertTrue($holidays->isHoliday($holiday), sprintf('Holiday `%s` not recognized as holiday for year `%u`', $key, $year)); + self::assertEquals($expectedDayOfWeek, $holiday->format('l'), sprintf('Wrong day of week for `%s` in year `%u`', $key, $year)); } /** @@ -290,7 +299,7 @@ public function assertDayOfWeek( */ public function assertSources(string $provider, int $expectedSourceCount): void { - $holidayProvider = Yasumi::create($provider, $this->generateRandomYear()); + $holidayProvider = Yasumi::create($provider, static::generateRandomYear()); self::assertCount($expectedSourceCount, $holidayProvider->getSources()); }