-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add assertObjectHasProperty()
and assertObjectNotHasProperty()
to PHPUnit 9.6
#5478
Labels
feature/assertion
Issues related to assertions and expectations
type/backward-compatibility
Something will be/is intentionally broken
version/9
Something affects PHPUnit 9
Comments
sebastianbergmann
added
type/backward-compatibility
Something will be/is intentionally broken
feature/assertion
Issues related to assertions and expectations
version/9
Something affects PHPUnit 9
labels
Aug 19, 2023
jrfnl
added a commit
to Yoast/PHPUnit-Polyfills
that referenced
this issue
Aug 19, 2023
…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>
jrfnl
added a commit
to Yoast/PHPUnit-Polyfills
that referenced
this issue
Aug 19, 2023
…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>
jrfnl
added a commit
to Yoast/PHPUnit-Polyfills
that referenced
this issue
Aug 19, 2023
…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>
jrfnl
added a commit
to Yoast/PHPUnit-Polyfills
that referenced
this issue
Aug 19, 2023
…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>
VerifiedJoseph
added a commit
to VerifiedJoseph/ntfy-php-library
that referenced
this issue
Aug 21, 2023
Updates tests to use phpunit method `assertObjectHasProperty()`. sebastianbergmann/phpunit#5478
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature/assertion
Issues related to assertions and expectations
type/backward-compatibility
Something will be/is intentionally broken
version/9
Something affects PHPUnit 9
The assertions
assertObjectHasAttribute()
andassertObjectNotHasAttribute()
were removed in PHPUnit 10.0. When this decision was made and the change implemented, there was no replacement planned for these methods.PHPUnit 9.6 was released alongside PHPUnit 10.0 to warn about functionality that was removed in PHPUnit 10.0. This is why PHPUnit 9.6.0 deprecated
assertObjectHasAttribute()
andassertObjectNotHasAttribute()
without suggesting an alternative.The functionality was reintroduced, using new methods names
assertObjectHasProperty()
andassertObjectNotHasProperty()
, in PHPUnit 10.1 because users convinced me that it is useful (I never had to use it myself). As of PHPUnit 9.6.7, the deprecations suggest to use these new methods.This series of events lead to a mess that was discussed in #5448 as well as here and here, for instance.
To fix this mess, I will add
assertObjectHasProperty()
andassertObjectNotHasProperty()
to PHPUnit 9.6.The text was updated successfully, but these errors were encountered: