Skip to content

Reduce output of Constraint failure descriptions, when asserting against trivial data types #5810

@glady

Description

@glady

When I write a test, that expects a boolean as return value, but - for some reason - does not get a boolean from the tested code, but a big array or an object, the whole object is dumped into the failure description. This potentially is a big waste of memory and makes reading the output quite hard.

Examples:

  • src/Framework/Constraint/Boolean/IsFalse.php
  • src/Framework/Constraint/Boolean/IsTrue.php

My feature request would be:

  • I would like just to get the message that its an object or an array, which was compared with false or true in this example instead of a dumped object / array
  • alternatively, if rejected, I want to have an option not to dump objects recursively at all (as its currently implemented in \PHPUnit\Framework\Constraint\Constraint::failureDescription) or even to choose an exporter logic on my own.

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