Problem/Motivation
In #540008: Add a container parameter that can remove the special behavior of UID#1 an approach was taken where we can simply flag tests that are failing if we turn off user 1's super user powers, so that they can be taken care of in a followup. This issue is to collect all of these followups.
The goal is to have no tests in Drupal core that rely on UID1's special privileges so that we:
- Know these tests are correctly assigning the necessary permissions to run
- Can turn off the super user access policy in D11, knowing it won't break core
- Can remove the super user access policy in D12, providing an admin account recovery tool to replace it
Steps to reproduce
Go into any of the tests flagged with:
/**
* {@inheritdoc}
*
* @todo Remove and fix test to not rely on super user.
* @see https://www.drupal.org/project/drupal/issues/3437620
*/
And:
- Remove the code below that sets the usesSuperUserAccessPolicy to TRUE.
- Run the test to see which test methods are failing
Proposed resolution
Assign the right permissions to make the test go green without the super user access policy. Those few tests that specifically test said policy can obviously stay, but will be removed along with the policy in D12.
Remaining tasks
- core/modules/comment/tests/src/
- Functional/CommentStatisticsTest.php
Issue fork drupal-3439830
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3439830-fix-comments-tests
changes, plain diff MR !7423
Comments
Comment #2
vensiresComment #5
thebumik commentedWould greatly appreciate it if someone could review my pull request for this. Any feedback would be invaluable!
Comment #6
nicxvan commentedWebuser2 has a duplicate permission, can you clean that up please?
Comment #7
thebumik commentedComment #8
kristiaanvandeneyndeSmall nitpick: I would keep the order of the user properties like it was. Now you have $webUser2 first with a comment calling it "a secondary user" before you even configured your primary user. It's a bit confusing in this order.
Suggestion: $adminUser above $webUser2.
Comment #9
smustgrave commentedSeems feedback has been addressed and think these permissions should be good
Comment #10
larowlanLeft a minor comment on the MR, fine to self RTBC once fixed
Comment #11
thebumik commentedApplied required changes. Should be fine now.
Comment #13
alexpottI've added some comments to the MR... I don't think we should be overwriting the adminUser with a new user.
Comment #15
thebumik commentedMR comments were addressed.
Comment #16
smustgrave commentedNot a huge fan of "more_admin_role" but it's a test so not a big deal to me.
Comment #17
alexpottCommitted and pushed 2b0321c170 to 11.x and d35edb34b2 to 10.3.x. Thanks!
Made the following changes on commit
Removed the unnecessary variable and reverted out of scope changes.