Skip to content

PHPUnit 9.6.11 | AssertObjectProperty trait: polyfill the Assert::assertObject[Not]HasProperty() methods#135

Merged
jrfnl merged 1 commit into
1.xfrom
feature/phpunit-9.6.11-add-assertobjecthaspropertytrait
Aug 19, 2023
Merged

PHPUnit 9.6.11 | AssertObjectProperty trait: polyfill the Assert::assertObject[Not]HasProperty() methods#135
jrfnl merged 1 commit into
1.xfrom
feature/phpunit-9.6.11-add-assertobjecthaspropertytrait

Conversation

@jrfnl

@jrfnl jrfnl commented Aug 19, 2023

Copy link
Copy Markdown
Collaborator

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
Copy Markdown

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
@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.

2 participants