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

PHPUnit 11.2.0 | AssertObjectNotEquals trait: polyfill the Assert::assertObjectNotEquals() method #199

Merged

Commits on Sep 6, 2024

  1. AssertObjectEquals: move comparator validation logic to `ComparatorVa…

    …lidator` helper class
    
    ... as the same logic is needed for the (upcoming) PHPUnit 11.2+ `AssertObjectNotEquals` trait.
    jrfnl committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    1c4fed6 View commit details
    Browse the repository at this point in the history
  2. PHPUnit 11.2.0 | AssertObjectNotEquals trait: polyfill the Assert::as…

    …sertObjectNotEquals() method
    
    PHPUnit 11.2.0 introduced the new `Assert::assertObjectNotEquals()` method.
    
    This commit:
    * Adds two traits with the same name.
        One to polyfill the method when not available in PHPUnit.
        The other to allow for `use`-ing the trait in PHPUnit versions in which the method is already natively available.
    * Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used.
    * Adds tests.
    
    As the polyfill contains logic to match the PHPUnit native implementation as closely as possible, while still being PHP and PHPUnit cross-version compatible, extensive unit tests have been added to ensure the behaviour of the polyfill matches that of the original function.
    
    Includes:
    * Adding information on the new polyfill to the README.
    * Adding the new polyfill to the existing `TestCases` classes.
    * Updating the class docs for the `InvalidComparisonMethodException` and the `ComparatorValidator` classes.
    
    Refs:
    * sebastianbergmann/phpunit#5811
    * sebastianbergmann/phpunit@8e3b7c1
    
    Co-authored-by: Sebastian Bergmann <[email protected]>
    jrfnl and sebastianbergmann committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    35688cc View commit details
    Browse the repository at this point in the history