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.
It should not be possible to change the 'global' property on an existing flag.
This regression is about the UI. We can file a task to enforce this at the API level too, or leave people able to hang themselves (as they could on D7).
Comments
Comment #2
joachim CreditAttribution: joachim commentedThis has caused me to dig up this very old issue: #882564: Add assertion helpers to AssertContentTrait for disabled/enabled fields.
Comment #4
joachim CreditAttribution: joachim commentedOh dear, the tests are doing the opposite of what they're meant to!
Comment #5
joachim CreditAttribution: joachim commentedI had the assertion the wrong way round...
Comment #7
BerdirI don't think that test method is called yet? the test only patch is supposed to fail...
What should we do with \Drupal\flag\Tests\FlagSimpleTest::doGlobalFlagLinksTest() then? That's the only global test coverage that there is right now. Move to a new test that creates a global flag and doesn't do the part about enabling and disabling the flag again?
Comment #8
joachim CreditAttribution: joachim commentedDrat! I didn't actually read the test result, as I only had about 5 minutes to reroll!
> Move to a new test that creates a global flag and doesn't do the part about enabling and disabling the flag again?
Yup, that makes sense.
Comment #9
socketwench CreditAttribution: socketwench at FFW commentedRefactored the global flag tests to their own test class, but for some reason it's still failing locally.
Comment #11
socketwench CreditAttribution: socketwench at FFW commentedIt'll still fail, but at least the flag link shows up the first time, after that, POOF!
Comment #13
joachim CreditAttribution: joachim commentedI was working on this one too...
I managed to get my refactoring to pass last night, but didn't have time to clean up and post a patch.
Comment #14
joachim CreditAttribution: joachim commentedI pondered doing this, but I feel the more parameters we add to this helper method, the less helpful it becomes -- at some point, it will simply have parameters for all of the flag properties, and then it might as well have a single $config param, and then we're no longer saving very much effort at all.
My take on refactoring the tests is to move both of doFlagLinksTest/doFlagGlobalLinksTest to a new test that focuses on access to a flag based on ownership. In due course we can add a test class for access based on permission, and also the access_author option.
Comment #17
BerdirTest needed a quick fix because global is now a radio element. I'm just checking the first radio button now.
Also removed t() from the assertion message, we stopped doing that a while ago.
Comment #19
BerdirI just did that minor change, everything else looks good to me. This blocks the load multiple issue, which is critical (which kind of makes this critical too), so would be nice to get it in.
Comment #21
joachim CreditAttribution: joachim commentedCommitted.