Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests: tweaks for PHPUnit 10.x compatibility #64

Merged
merged 1 commit into from
Nov 3, 2021

Commits on Nov 3, 2021

  1. Tests: tweaks for PHPUnit 10.x compatibility

    Initial tweaks to make the tests compatible with PHPUnit 10.x, which enforces a `mixed` return type for the `TestCase::runTest()` method.
    
    To test the TestListener, prior to PHPUnit 7.0, overloading the `runTest()` method works best, but as of PHPUnit 10.0, the `runTest()` method has a `mixed` return type declaration (PHP 8.0+).
    However, since PHPUnit 7.0, testing the TestListener also works when the test name with which the `TestCase` is instantiated is not `runTest()`.
    
    So either way, the fixtures used for the TestListener tests need to be duplicated and have two variations.
    
    Now the choice was which option to choose:
    * Duplicate the classes and add a return type to the `runTest()` method.
    * Duplicate the classes and rename the test method.
    
    I investigated both options and have decided to implement option 2 as `void` is not accepted as covariant with `mixed` and these methods are all `void` methods, so adding `mixed` as the return type would be misrepresenting the functionality.
    
    The toggle for which test class to load for the various tests has been implemented with a helper method.
    jrfnl committed Nov 3, 2021
    Configuration menu
    Copy the full SHA
    fd6d557 View commit details
    Browse the repository at this point in the history