Skip to content

Conversation

@duboism
Copy link
Contributor

@duboism duboism commented Oct 1, 2024

Goal

Currently, the code is not compatible with PHP 8. This PR is a first step toward this.

In order to be able to run the test suite on a large span of PHP versions, this PR converts it to PHPUniPolyFills. With this the command vendor/bin/phpunit tests runs with PHP 7.4 without modifying the code (and with some simple modifications, it runs with PHP 8.3).

This is similar to pear/HTML_Template_IT#17.

Technical details

I constrained PHP versions in composer.json.

There is almost no change to the test suite itself except:

  • Test cases inherits from Yoast\PHPUnitPolyfills\TestCases\TestCase so they must implement set_up/tear_down (instead of setUp/tearDown). See the doc here.
  • I suppressed the file AllTests.php because I could not port it. AFAIU, it doesn't change the tests.
  • I replaced the long deprecated assertInternalType by assertIsArray.

@ashnazg ashnazg self-assigned this Nov 24, 2024
@ashnazg ashnazg merged commit e050165 into pear:master Nov 24, 2024
@duboism
Copy link
Contributor Author

duboism commented Nov 24, 2024

Thanks for merging this @ashnazg.

@duboism duboism deleted the port_tests_to_phpunit_polyfill branch November 24, 2024 21:34
@Neustradamus

This comment was marked as off-topic.

@duboism duboism mentioned this pull request Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants