-
-
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
Add support for checking subsets that contain duplicate values to ArraySubset #3186
Add support for checking subsets that contain duplicate values to ArraySubset #3186
Conversation
Since `&&` has a higher precendence than `||` the parentheses are unneeded but adding them makes is easier to understand.
Codecov Report
@@ Coverage Diff @@
## master #3186 +/- ##
============================================
+ Coverage 82.37% 82.37% +<.01%
- Complexity 3508 3512 +4
============================================
Files 140 140
Lines 9243 9245 +2
============================================
+ Hits 7614 7616 +2
Misses 1629 1629
Continue to review full report at Codecov.
|
We have a few tests that started failing when phpunit 7.3 was released.
|
@KristopherWindsor did you try it with this PR? I see you have duplicate values in your subset. That's what this PR is fixing. If it is not, could you provide a test case so I can have a look? |
In #3240 a regression was reported against |
This proves that the bug reported in sebastianbergmann#3240 is also fixed in scope of this PR.
cbb0f24
to
c0c94e9
Compare
@pfrenssen We use the Laravel framework here at work, and serveral tests stopped working when upgrading to PHPUnit 7.3.0 due to the ArraySubset change. I can confirm this PR fixes any failing tests that were introduced with the 7.3.0 changes in our companies codebase. |
I have reverted #3161 because of #3240. @pfrenssen Please send a new pull request against |
Having some background in mathematics and also in python programming language I find this way of thinking really confusing. In mathematical set theory, an object just may be or may not be a member of a set. In set theory there is no concept of an object being a member "more than once" of a set. This reasoning is applied in python, where the following expression evaluates as
Please kindly take my remarks into your consideration. |
@pfrenssen Did you have a chance to create a new PR containing both #3161 and #3186? Would you like me to look into it? |
@Stadly I have this on my to-do list which is admittedly very long :) I don't think I will get round to this very soon, so feel free to open the PR if you want. I would be glad if you could keep my git history so I can get credit for the work, but if this is not practical for you then don't worry. Would be nice to see this merged indeed! |
In #3161 support was added for checking indexed arrays in
ArraySubset
. The edge case of checking subsets that contain multiple identical values was left out of the scope of that PR. This means that in the current implementation the following example will generate a false positive:[0, 1, 2, 3]
[0, 1, 1, 2]
FALSE
since the value1
is only present once in the array, but twice in the subset.TRUE
This PR adds support for this edge case, so that it will become possible to check subsets with duplicate values.