Fix Path tests that rely on UID1's super user behavior

Created on 10 April 2024, 8 months ago
Updated 29 April 2024, 8 months ago

Problem/Motivation

In ๐Ÿ“Œ Add a container parameter that can remove the special behavior of UID#1 Fixed 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:

  1. Know these tests are correctly assigning the necessary permissions to run
  2. Can turn off the super user access policy in D11, knowing it won't break core
  3. 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:

  1. Remove the code below that sets the usesSuperUserAccessPolicy to TRUE.
  2. 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/path/tests/src/
    • Functional/PathContentModerationTest.php
๐Ÿ“Œ Task
Status

Fixed

Version

10.3 โœจ

Component
Pathย  โ†’

Last updated about 3 hours ago

  • Maintained by
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom @catch
Created by

๐Ÿ‡ฌ๐Ÿ‡ทGreece vensires

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @vensires
  • First commit to issue fork.
  • Merge request !7429Issue #3439904: Fix path moderation tests โ†’ (Open) created by thebumik
  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฒ๐Ÿ‡ฉMoldova thebumik

    Fixed path tests. Please review

  • Pipeline finished with Failed
    8 months ago
    Total: 188s
    #143117
  • Status changed to Needs work 8 months ago
  • The Needs Review Queue Bot โ†’ tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

    Consult the Drupal Contributor Guide โ†’ to find step-by-step guides for working with issues.

  • Pipeline finished with Failed
    8 months ago
    #143220
  • Pipeline finished with Failed
    8 months ago
    Total: 1001s
    #143262
  • Pipeline finished with Canceled
    8 months ago
    Total: 914s
    #143290
  • Pipeline finished with Failed
    8 months ago
    Total: 989s
    #143298
  • Pipeline finished with Failed
    8 months ago
    #143317
  • Pipeline finished with Failed
    8 months ago
    Total: 1076s
    #143514
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium kristiaanvandeneynde Antwerp, Belgium
        There were 2 errors:
        
        1)
        Drupal\Tests\path\Functional\PathContentModerationTest::testNodePathAlias
        Behat\Mink\Exception\ElementNotFoundException: Form field with
        id|name|label|value "path[0][alias]" not found.
        
        /builds/issue/drupal-3439904/vendor/behat/mink/src/WebAssert.php:731
        /builds/issue/drupal-3439904/vendor/behat/mink/src/WebAssert.php:768
        /builds/issue/drupal-3439904/core/tests/Drupal/Tests/WebAssert.php:968
        /builds/issue/drupal-3439904/core/modules/path/tests/src/Functional/PathContentModerationTest.php:111
        /builds/issue/drupal-3439904/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
        
        2)
        Drupal\Tests\path\Functional\PathContentModerationTest::testTranslatedModeratedNodeAlias
        Behat\Mink\Exception\ElementNotFoundException: Button with
        id|name|label|value "Save (this translation)" not found.
        
        /builds/issue/drupal-3439904/core/tests/Drupal/Tests/WebAssert.php:151
        /builds/issue/drupal-3439904/core/tests/Drupal/Tests/UiHelperTrait.php:78
        /builds/issue/drupal-3439904/core/modules/path/tests/src/Functional/PathContentModerationTest.php:207
        /builds/issue/drupal-3439904/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    
  • Pipeline finished with Success
    8 months ago
    Total: 958s
    #143794
  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฒ๐Ÿ‡ฉMoldova thebumik
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium kristiaanvandeneynde Antwerp, Belgium

    Left a comment, not sure if we want to switch from relying on UID1 to relying on being able to bypass all node permissions. The goal is that our tests prove that whoever has the right permissions (without super user stuff), can use the website as intended for their role.

  • Pipeline finished with Success
    8 months ago
    Total: 1049s
    #143908
  • Status changed to Needs work 8 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Left a comment but not sure we need all those modules installed for this test

  • Pipeline finished with Success
    8 months ago
    Total: 959s
    #144036
  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฒ๐Ÿ‡ฉMoldova thebumik
  • Status changed to RTBC 8 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Reviewed the permissions and believe those should be fine, didn't seem to have a crazy one to me.

  • Status changed to Needs work 8 months ago
  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia larowlan ๐Ÿ‡ฆ๐Ÿ‡บ๐Ÿ.au GMT+10

    Left a comment on the MR

  • Pipeline finished with Failed
    8 months ago
    #144683
  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฒ๐Ÿ‡ฉMoldova thebumik
  • Pipeline finished with Success
    8 months ago
    #144689
  • Status changed to RTBC 8 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Feedback addressed.

  • Status changed to Needs work 8 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    Added a couple of comments to the MR. There's no need to add permissions as a class property to the test.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia pradhumanjainOSL

    pradhumanjain2311 โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    8 months ago
    Total: 208s
    #145627
  • ๐Ÿ‡ฒ๐Ÿ‡ฉMoldova thebumik

    Addressed the comments from PR.

  • Status changed to Needs review 8 months ago
  • ๐Ÿ‡ฒ๐Ÿ‡ฉMoldova thebumik
  • Pipeline finished with Success
    8 months ago
    Total: 958s
    #147137
  • Status changed to RTBC 8 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Thanks for addressing @thebumik.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom alexpott ๐Ÿ‡ช๐Ÿ‡บ๐ŸŒ

    Committed and pushed eeb7e60c30 to 11.x and 7e4ccefc08 to 10.3.x. Thanks!

  • Status changed to Fixed 8 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024