-
-
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
Remove assertArraySubset() #3495
Comments
I just started really focusing on unit testing and I was actually looking for this functionality. For me, it makes sense and is useful. In this test, I'm testing an array of arrays (friends). I always know one element will exist, however it's failing for the following reason. The response will look like this (with surrounding elements of course):
I think the function could be useful...but after reading some of those issues...maybe a rewrite of the function would be better? |
Same as @MatthewSH. I use the assertion, I find it quite straightforward to understand actually. It will be missed! |
Indeed this assertion has caused me the same headache as by looking at the name I could argue that something like |
I use |
Seeing issues like #2069 I agree. Should keys match or just value? What if user needs that? How can we know? |
@JKingweb Could you help me to cover your case in upgrade path? So you won't have to deal with that manually: rectorphp/rector#1193 |
I can certainly try. Please feel free to contact me with details on what you'd need. |
@JKingweb I've merged first dumb implementation. Report any issues found to Rector issues. There will be many in the start, but we'll try to handle one by one :) |
Based on the changelog of PHPUnit 9.0, the method has been removed, but it was still in the documentation. Refs: * https://github.com/sebastianbergmann/phpunit/blob/9.0.1/ChangeLog-9.0.md * sebastianbergmann/phpunit#3495
Based on the changelog of PHPUnit 9.0, the method has been removed, but it was still in the documentation. Refs: * https://github.com/sebastianbergmann/phpunit/blob/9.0.1/ChangeLog-9.0.md * sebastianbergmann/phpunit#3495
The
assertArraySubset()
method is a constant source of confusion and frustration. For example, see #2069, #2108, #2568, #3101, #3234, #3240, or #3319.I have come to the conclusion that this mess cannot be fixed without breaking backward compatibility. In addition to that, I myself have yet to see a use case for this or how this would be used then. I have also not seen this used in the wild.
This is why I decided to deprecate
assertArraySubset()
in PHPUnit 8 and to remove it in PHPUnit 9. Anybody who thinks this functionality is useful is more than welcome to take the code, put it into a separate project, and package it as an extension for PHPUnit.The text was updated successfully, but these errors were encountered: