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

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

Open
glady opened this issue Apr 11, 2024 · 0 comments
Labels
feature/assertion Issues related to assertions and expectations type/enhancement A new idea that should be implemented

Comments

@glady
Copy link

glady commented Apr 11, 2024

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.
@glady glady added the type/enhancement A new idea that should be implemented label Apr 11, 2024
@sebastianbergmann sebastianbergmann added the feature/assertion Issues related to assertions and expectations label Apr 11, 2024
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/enhancement A new idea that should be implemented
Projects
None yet
Development

No branches or pull requests

2 participants