Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Thanks for all your contributions recently -- hope to see you again in the issue queue in future! (Also, BTW, I think I saw you're in the UK. Drop on in #drupal-uk on IRC sometime! :)
- $this->assertTrue($flag_count_flagged = $flag_count_pre + 1, "The flag count was incremented.");
+ $this->assertEqual($flag_count_flagged, $flag_count_pre + 1, "The flag count was incremented.");
I guess one reason we have assertEqual() is that it means you can't make the mistake I made of using = instead of ==.
Comments
Comment #1
martin107 CreditAttribution: martin107 commentedWhen I was looking at a patch for #2465865: Change FlagService::flag() and ::unflag() to use objects to discourage use of IDs
My take on this bug was that
unflagByObject and unflag would have to be merged some how
and as well as the flag count being an issue -- well the handling of $account was also inconsistent and the merge would have to deal with that too.
I am suddenly busy -- will be silent for a few days..:(
Comment #2
joachim CreditAttribution: joachim commentedI'd rather we fix this bug first, so the commit history records a clear bug fix, separately from a refactor. Makes git blame and bisect much easier.
Comment #3
joachim CreditAttribution: joachim commentedAssigning myself to this one then!
Thanks for all your contributions recently -- hope to see you again in the issue queue in future! (Also, BTW, I think I saw you're in the UK. Drop on in #drupal-uk on IRC sometime! :)
Comment #4
joachim CreditAttribution: joachim commentedComment #5
joachim CreditAttribution: joachim commentedUhoh. I have a bad feeling about this:
Flags don't have a fid and haven't for ages. I suspect all our flag count API functions are broken!
Comment #6
joachim CreditAttribution: joachim commentedPostponed by #2466385: flag count API functions are broken.
Comment #7
socketwench CreditAttribution: socketwench commentedLooks like we missed adding test coverage for this too. >_<
Comment #8
joachim CreditAttribution: joachim commentedWe can't commit broken tests, so we need to fix this here, and add basic tests here, which we can then refine when the flag count API is fixed.
Comment #9
joachim CreditAttribution: joachim commentedComment #12
joachim CreditAttribution: joachim commentedWeird. The patch fixes the problem for me when I try it by hand.
Comment #13
joachim CreditAttribution: joachim commentedSigh...
I guess one reason we have assertEqual() is that it means you can't make the mistake I made of using = instead of ==.
Comment #14
joachim CreditAttribution: joachim commentedComment #15
joachim CreditAttribution: joachim commentedArgh, how do I trigger the testbot?
Comment #16
martin107 CreditAttribution: martin107 commentedSometimes the only way is to re-upload. let see if this takes.
Comment #17
joachim CreditAttribution: joachim commentedTurns out it's not just us: #2467621: Tests not being added to the testbot queue.
Comment #20
martin107 CreditAttribution: martin107 commentedYes when the problem is laid bare.... it is obvious decrementFlagCounts() in the wrong place...
Tests look good and complete to me :)
So +1.
[Also This is a blocker so it would be good to get in. ]
Comment #21
joachim CreditAttribution: joachim commentedI'm going to call that an RTBC and commit it. Thanks for the review!
Comment #22
joachim CreditAttribution: joachim commented