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/media(_library)/tests/src/
- Functional/MediaRequirementsTest.php
- FunctionalJavascript/ContentModerationTest.php
Issue fork drupal-3439898
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:
- 3439898-fix-media-tests
changes, plain diff MR !7555
Comments
Comment #4
simonbaeseThe
ContentModerationTestmade a distinction between the user 1 and an admin user. Therefore, all tests forrootUserwere simply removed.Comment #5
smustgrave commentedSeems like a good refactor.
Comment #6
alexpottI'm not sure about the changes to core/modules/media_library/tests/src/FunctionalJavascript/ContentModerationTest.php it seems to be testing user 1 specific stuff. I think we need to carefully think about why the user 1 tests are here because we have the admin user here already.
Comment #7
smustgrave commentedBut with the addition of #540008: Add a container parameter that can remove the special behavior of UID#1 should we be testing user1 stuff?
Comment #9
quietone commentedI asked in Slack, #media, about why the test was specifically testing user #1. Two media maintainers, marcoscano and seanb responded saying that they saw no reason for it. seanb also said that they probably copied the test from somewhere else and then made it work for media.
So, I think it is OK to remove the specific assertions with user #1. Therefor restoring the RTBC.
Comment #15
nod_test failure that seems legit
Comment #16
nod_appears random #3511123: Remove cache tag checksum assertions from performance tests
Comment #18
nod_Committed 0948fc8 and pushed to 11.x. Thanks!
Comment #20
nod_