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 9.6.11 | AssertObjectProperty trait: polyfill the Assert::assertObject[Not]HasProperty() methods #135

Merged
merged 1 commit into from
Aug 19, 2023

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Aug 19, 2023

PHPUnit 10.1.0 introduced the new Assert::assertObjectHasProperty() and Assert::assertObjectNotHasProperty() methods.

These methods have now been backported to PHPUnit 9.6.11, so should be made available in the PHPUnit Polyfills 1.x series.

This commit:

  • Adds two traits with the same name. One to polyfill the methods when not available in PHPUnit. The other - an empty trait - to allow for use-ing the trait in PHPUnit versions in which the methods are already natively available.
  • Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used.
  • An availability test and functional tests for the functionality polyfilled.

Includes:

  • Adding the new polyfill to the existing TestCases classes.

Refs:

…ertObject[Not]HasProperty() methods

PHPUnit 10.1.0 introduced the new `Assert::assertObjectHasProperty()` and `Assert::assertObjectNotHasProperty()` methods.

These methods have now been backported to PHPUnit 9.6.11, so should be made available in the PHPUnit Polyfills 1.x series.

This commit:
* Adds two traits with the same name.
    One to polyfill the methods when not available in PHPUnit.
    The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available.
* Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used.
* An availability test and functional tests for the functionality polyfilled.

Includes:
* Adding the new polyfill to the existing `TestCases` classes.

Refs:
* sebastianbergmann/phpunit#5220
* sebastianbergmann/phpunit#5231 (and follow up commits/PRs)
* sebastianbergmann/phpunit#5478

Co-authored-by: Jan-Sverre Riksfjord <jasverix@gmail.com>
Co-authored-by: Sebastian Bergmann <sb@sebastian-bergmann.de>
@coveralls
Copy link

Coverage Status

coverage: 97.814% (+1.4%) from 96.439% when pulling 2810188 on feature/phpunit-9.6.11-add-assertobjecthaspropertytrait into f4c425a on 1.x.

@jrfnl jrfnl merged commit 305e917 into 1.x Aug 19, 2023
84 checks passed
@jrfnl jrfnl deleted the feature/phpunit-9.6.11-add-assertobjecthaspropertytrait branch August 19, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants