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: make test suite compatible with PHPUnit 10.x #483

Merged
merged 13 commits into from Jun 12, 2023

Commits on Jun 6, 2023

  1. Composer: update the PHPUnit Polyfills

    A PHPUnit 10 compatible version of the PHPUnit Polyfills has been released, so let's start using it.
    
    Ref:
    * https://github.com/Yoast/PHPUnit-Polyfills/releases/tag/2.0.0
    jrfnl committed Jun 6, 2023
    Configuration menu
    Copy the full SHA
    df2a845 View commit details
    Browse the repository at this point in the history
  2. Tests/PolyfilledTestCase: make compatible with PHPUnit Polyfills 2.x

    As the available traits are different between the 1.x and 2.x versions of the PHPUnit Polyfills, two different class definitions are needed.
    
    This change uses the available PHPUnit Polyfills version number to load the correct class.
    jrfnl committed Jun 6, 2023
    Configuration menu
    Copy the full SHA
    ce14e92 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    80c3723 View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2023

  1. Tests: make dataproviders static

    As of PHPUnit 10, data providers are (again) expected to be `static` methods.
    
    This updates the test suite to respect that.
    
    Includes removing the use of `$this` from select data providers.
    
    Refs:
    * sebastianbergmann/phpunit@9caafe2
    * sebastianbergmann/phpunit 5100
    jrfnl committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    47a7549 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8f3df55 View commit details
    Browse the repository at this point in the history
  3. Tests/InterpolatedVariablesTest: make data providers static for com…

    …patibility with PHPUnit 10
    jrfnl committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    6e8a439 View commit details
    Browse the repository at this point in the history
  4. Tests/[NoFile]Cache/SetTest: remove use of the remove PHPUnit `TestCa…

    …se::getName()` method
    
    ... in favour of just using a randomly generated ID for the cache.
    jrfnl committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    90a6179 View commit details
    Browse the repository at this point in the history
  5. Tests/HasNewLineSupportTest: work round removal of the `setOutputCall…

    …back()` method
    
    PHPUnit 10.0 removed the `TestCase::setOutputCallback()` method without replacement.
    
    Refs:
    * sebastianbergmann/phpunit 5319
    jrfnl committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    c1ad96c View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    ed53f2e View commit details
    Browse the repository at this point in the history
  7. Tests: add new ExpectWithConsecutiveArgs helper trait

    ... to provide a work-around for the removal of the `InvocationMocker->withConsecutive()` method, which was removed without replacement in PHPUnit 10.0.
    
    Refs:
    * sebastianbergmann/phpunit 4026
    * sebastianbergmann/phpunit 4255
    * sebastianbergmann/phpunit 4564
    jrfnl committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    8ecebee View commit details
    Browse the repository at this point in the history
  8. Tests/AbstractArrayDeclarationSniffTest: implement use of the `Expect…

    …WithConsecutiveArgs` helper
    jrfnl committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    ddcecc9 View commit details
    Browse the repository at this point in the history
  9. Tests/AbstractArrayDeclarationSniffTest: work around for `MockBuilder…

    …::setMethods()` removal
    
    Please note:
    * The `getMockBuilder()` class is also deprecated now, so replacing with another method call on the `MockBuilder` class will only work in the short/medium term and in a future iteration, this will have to be refactored again.
    * Also the `getMockForAbstractClass method is also deprecated and expected to be removed in PHPUnit 12.
    
    Refs:
    * sebastianbergmann/phpunit 3687#issuecomment-492537584
    * sebastianbergmann/phpunit 3770
    * sebastianbergmann/phpunit 3769
    * sebastianbergmann/phpunit 4775
    jrfnl committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    6653cdd View commit details
    Browse the repository at this point in the history
  10. PHPUnit: add separate configuration for PHPUnit 10

    PHPUnit 10 makes significant changes to the configuration file.
    While there is a `--migrate-configuration` option available in PHPUnit, that doesn't get us a well enough converted configuration file, so instead use a separate `phpunit10.xml.dist` file for running the tests on PHPUnit 10 with an optimal configuration.
    
    Includes
    * Adding separate scripts to the `composer.json` file to make this more obvious for contributors.
    * Updating the GH Actions workflows to take the new configuration file into account when appropriate.
    * Selectively not using the `--repeat` option, which was [removed without replacement](sebastianbergmann/phpunit#5174) in PHPUnit 10.
    jrfnl committed Jun 12, 2023
    Configuration menu
    Copy the full SHA
    1914d5f View commit details
    Browse the repository at this point in the history