Phpunit: Remove $maxDepth attribute, parameter, etc.

Created on 10 Oct 2018  ·  4Comments  ·  Source: sebastianbergmann/phpunit

typbackward-compatibility

Most helpful comment

Removing the $maxDepth parameter from assertEquals() etc. will break all tests that use assertEquals() with optional parameters that go after $maxDepth.

The only way to clean up assertEquals() that {hopefully|possibly} causes less problems would be to clean up more drastically and not only remove $maxDepth but also all optional parameters that come after it. This, too, is not really appealling.

All these optional parameters should have never been added, they make for a terrible API. I am not sure, though, if the benefit of cleaning up assertEquals() etc. by removing these optional parameters and adding more specific assertion methods in their stead outweighs the pain of breaking compatibility.

All 4 comments

Also replaces #3180.

Removing the $maxDepth parameter from assertEquals() etc. will break all tests that use assertEquals() with optional parameters that go after $maxDepth.

The only way to clean up assertEquals() that {hopefully|possibly} causes less problems would be to clean up more drastically and not only remove $maxDepth but also all optional parameters that come after it. This, too, is not really appealling.

All these optional parameters should have never been added, they make for a terrible API. I am not sure, though, if the benefit of cleaning up assertEquals() etc. by removing these optional parameters and adding more specific assertion methods in their stead outweighs the pain of breaking compatibility.

The only parameter that I used sometimes is the ignore case one. Never used any other.

Migrating to a dedicated assertion for that seems a reasonable upgrade path for me.

Superseded by #3341.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AnmSaiful picture AnmSaiful  ·  4Comments

ezzatron picture ezzatron  ·  3Comments

rentalhost picture rentalhost  ·  4Comments

sebastianbergmann picture sebastianbergmann  ·  4Comments

keradus picture keradus  ·  3Comments