BlockContentRevisionsTest should use admin account

Created on 27 August 2016, over 8 years ago
Updated 10 January 2024, about 1 year ago

Problem/Motivation

Currently the test checks that text is not present on the page, however it does this as the anonymous user which gets an access denied on this page anyway.https://git.drupalcode.org/project/drupal/-/commit/b2320bc9d58ee9c5df269...

    $this->drupalGet('admin/content/block/' . $loaded->id());
    $this->assertSession()->pageTextNotContains($loaded->body->value);

pageTextNotContains() doesn't make sense here because the page is not available for anonymous user.

Steps to reproduce

NA

Proposed resolution

Login as $this->adminUser in the test.
per @xjm in #22 extend test coverage

Remaining tasks


Review

User interface changes

NA

API changes

NA

Data model changes

NA

Release notes snippet

NA

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Block contentΒ  β†’

Last updated 20 days ago

Created by

πŸ‡·πŸ‡ΊRussia Chi

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
  • Status changed to Needs work about 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    It's not clear to me from the comments or IS why exactly we need to login as the admin user?

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    +1 for logging in as a user with the minimum set of permissions rather than the admin user. Using the admin user masks subtle bugs.

  • Status changed to Needs review about 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Slightly tweaked based on @larowlan comment in #29

    Addressed feedback.

  • Status changed to Needs work about 1 year ago
  • πŸ‡¦πŸ‡ΊAustralia acbramley

    Updated the IS to be more accurate. I'm honestly questioning whether we need this test at all. It's testing the most arbitrary stuff and was first added in a very similar state 10 years ago https://git.drupalcode.org/project/drupal/-/commit/b2320bc9d58ee9c5df269...

    What the test does (currently):

    1. Checks the log message set by setRevisionLogMessage in setUp is the same when loading the block revision - Seems redundant.
    2. Checks the revision user, revision id and revision create time are the correct data types, except for the first revision - Very redundant and also exposes a bug that I've reported elsewhere (will find the link soon)
    3. Checks the latest revision is the default revision - Also redundant.
    4. Checks unpublished/non default revision's body text doesn't appear on the frontpage - Possibly useful
    5. Checks the block edit form is a 200 and doesn't contain the latest revision's body text - Redundant and potentially a bug since the edit form SHOULD contain the latest revision's content
    6. Checks the latest revision id is greater than the default revision id - very reundant
    7. Checks the frontpage contains the default revision's body text - possibly useful

    When I say redundant I mean it's probably tested elsewhere, or completely useless.

    Setting to NW because honestly I reckon we ditch the test entirely after confirming we're covered elsewhere.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So just checking item 1 this appears to be the only test using setRevisionLogMessage and testing the message on the version-history page.

    So not 100% sure it is covered elsewhere.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    this appears to be the only test using setRevisionLogMessage and testing the message on the version-history page.

    But it doesn't check the version history page? It checks getRevisionLogMessage returns what was set in setUp

    We do have other testing for the version history page though! https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/block...

Production build 0.71.5 2024