azuyalabs / yasumi

The easy PHP Library for calculating holidays
https://www.yasumi.dev
Other
1.04k stars 152 forks source link

Support php 8.1 #269

Closed sylvaincombes closed 2 years ago

sylvaincombes commented 2 years ago

From what I have tested the tests doesn't pass with php 8.1 version, we should correct this

Here is log output :

There were 15 failures:

1) Yasumi\tests\Base\HolidayBetweenFilterTest::testHolidaysBetweenDateRange
Failed asserting that an array has the key 'summerTime'.

yasumi/tests/Base/HolidayBetweenFilterTest.php:56
yasumi/vendor/phpunit/phpunit/phpunit:92

2) Yasumi\tests\Base\HolidayBetweenFilterTest::testHolidaysBetweenDateRangeWithDateTimeImmutable
Failed asserting that an array has the key 'summerTime'.

yasumi/tests/Base/HolidayBetweenFilterTest.php:111
yasumi/vendor/phpunit/phpunit/phpunit:92

3) Yasumi\tests\Base\HolidayBetweenFilterTest::testHolidaysBetweenDateRangeExclusiveStartEndDate
Failed asserting that an array has the key 'summerTime'.

yasumi/tests/Base/HolidayBetweenFilterTest.php:200
yasumi/vendor/phpunit/phpunit/phpunit:92

4) Yasumi\tests\Base\HolidayFiltersTest::testSeasonalHolidaysFilter
Failed asserting that an array has the key 'summerTime'.

yasumi/tests/Base/HolidayFiltersTest.php:154
yasumi/vendor/phpunit/phpunit/phpunit:92

5) Yasumi\tests\Base\HolidayOnFilterTest::testHolidaysOnDate
Failed asserting that an array has the key 'summerTime'.

yasumi/tests/Base/HolidayOnFilterTest.php:56
yasumi/vendor/phpunit/phpunit/phpunit:92

6) Yasumi\tests\Base\HolidayOnFilterTest::testCorrectNumberOfHolidaysOnDate
Failed asserting that 1 is greater than 1.

yasumi/tests/Base/HolidayOnFilterTest.php:103
yasumi/vendor/phpunit/phpunit/phpunit:92

7) Yasumi\tests\Denmark\DenmarkTest::testSeasonalHolidays
Failed asserting that an array has the key 'summerTime'.

yasumi/tests/YasumiBase.php:89
yasumi/tests/Denmark/DenmarkTest.php:84
yasumi/vendor/phpunit/phpunit/phpunit:92

8) Yasumi\tests\Denmark\SummerTimeTest::testSummerTime
Failed asserting that null is an instance of class "Yasumi\Holiday".

yasumi/tests/YasumiBase.php:117
yasumi/tests/Denmark/SummerTimeTest.php:53
yasumi/vendor/phpunit/phpunit/phpunit:92

9) Yasumi\tests\Denmark\SummerTimeTest::testTranslation
Failed asserting that null is an instance of class "Yasumi\Holiday".

yasumi/tests/YasumiBase.php:225
yasumi/tests/Denmark/SummerTimeTest.php:71
yasumi/vendor/phpunit/phpunit/phpunit:92

10) Yasumi\tests\Denmark\SummerTimeTest::testHolidayType
Failed asserting that null is an instance of class "Yasumi\Holiday".

yasumi/tests/YasumiBase.php:273
yasumi/tests/Denmark/SummerTimeTest.php:82
yasumi/vendor/phpunit/phpunit/phpunit:92

11) Yasumi\tests\Denmark\WinterTimeTest::testWinterTime
Failed asserting that null is an instance of class "Yasumi\Holiday".

yasumi/tests/YasumiBase.php:117
yasumi/tests/Denmark/WinterTimeTest.php:57
yasumi/vendor/phpunit/phpunit/phpunit:92

12) Yasumi\tests\Denmark\WinterTimeTest::testHolidayType
Failed asserting that null is an instance of class "Yasumi\Holiday".

yasumi/tests/YasumiBase.php:273
yasumi/tests/Denmark/WinterTimeTest.php:83
yasumi/vendor/phpunit/phpunit/phpunit:92

13) Yasumi\tests\Netherlands\NetherlandsTest::testSeasonalHolidays
Failed asserting that an array has the key 'summerTime'.

yasumi/tests/YasumiBase.php:89
yasumi/tests/Netherlands/NetherlandsTest.php:88
yasumi/vendor/phpunit/phpunit/phpunit:92

14) Yasumi\tests\Netherlands\SummertimeTest::testTranslation
Failed asserting that null is an instance of class "Yasumi\Holiday".

yasumi/tests/YasumiBase.php:225
yasumi/tests/Netherlands/SummertimeTest.php:72
yasumi/vendor/phpunit/phpunit/phpunit:92

15) Yasumi\tests\Netherlands\SummertimeTest::testHolidayType
Failed asserting that null is an instance of class "Yasumi\Holiday".

yasumi/tests/YasumiBase.php:273
yasumi/tests/Netherlands/SummertimeTest.php:83
yasumi/vendor/phpunit/phpunit/phpunit:92

FAILURES!
Tests: 16347, Assertions: 50486, Failures: 15.
Script vendor/bin/phpunit handling the test event returned with error code 1
stelgenhof commented 2 years ago

@sylvaincombes Thanks for spotting this. From a first look, it is related to the summer/wintertime calculation. Seems some transitions are missing. I will investigate further.

stelgenhof commented 2 years ago

Issue with PHP8.1: https://github.com/php/php-src/issues/7752

github-actions[bot] commented 2 years ago

Since this issue has not had any activity within the last 90 days, I have marked it as stale. I will close it if no further activity occurs within the next 10 days.

stelgenhof commented 2 years ago

Based on the comments of the issue (https://github.com/php/php-src/issues/7752) this issue has been fixed and looks to be set to be included in PHP 8.1.6

stelgenhof commented 2 years ago

Tested it locally with 8.1.6 and the tests run correctly.

PHP 8.1.6 (cli) (built: May 15 2022 06:10:08) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.6, Copyright (c) Zend Technologies
    with Xdebug v3.1.4, Copyright (c) 2002-2022, by Derick Rethans
................                                            16418 / 16418 (100%)

Time: 00:06.068, Memory: 200.00 MB

OK (16418 tests, 50891 assertions)

@sylvaincombes Could you try with the updated 8.1.6 version as well and let me know if the tests run successfully? Thanks!

sylvaincombes commented 2 years ago

Hello @stelgenhof I tested it locally with php 8.1.6 branch master and develop, all is green

stelgenhof commented 2 years ago

@sylvaincombes Thanks for verifying! I'll close this issue and mention that only PHP >= 8.1.6 is supported.