Skip to content

Add assertObjectHasProperty() and assertObjectHasNotProperty() #5220

Closed
@jasverix

Description

@jasverix

The assertObjectHasAttribute() is deprecated because the word "attribute" means something different in the PHP world now. But it was deprecated without any replacement, stating that it is bad code causing this assertion, one should use classes etc instead.

The problem is that I am using PhpUnit to unit-test my JSON API, and I cannot see a replacement for just checking the JSON structure. Of course, assertTrue(property_exists()) works, but the error message yielded is not nearly as good as assertObjectHasAttribute was.

Can we consider making assertObjectHasProperty()? That name will never be wrong, because it is the exact same word as in property_exists().

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature/assertionIssues related to assertions and expectationstype/enhancementA new idea that should be implemented

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions