Problem/Motivation

A minor code comment mistake in NodeFieldAccessTest.php.
The text should be 'with revisions enabled', not 'disabled'.

Steps to reproduce

Check web/core/modules/node/tests/src/Kernel/NodeFieldAccessTest.php

    // Create the article node type with revisions disabled.
    $article = NodeType::create([
      'type' => 'article',
      'new_revision' => TRUE,
    ]);
    $article->save();

Proposed resolution

Correct the comment text.

Remaining tasks

Check and fix same issue in other versions.

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3334679

Command icon 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:

Comments

Lugir created an issue. See original summary.

longwave’s picture

Status: Active » Reviewed & tested by the community

Thanks - the original comment is wrong, the updated comment is correct.

  • xjm committed c2b81839 on 10.1.x
    Issue #3334679 by Lugir: A minor code comment mistake in...

  • xjm committed eeafec56 on 10.0.x
    Issue #3334679 by Lugir: A minor code comment mistake in...

  • xjm committed faf578bb on 9.5.x
    Issue #3334679 by Lugir: A minor code comment mistake in...
xjm’s picture

Status: Reviewed & tested by the community » Fixed

With bugs like this, I always look at the context to make sure it's not more than just a typo. In this case, the lines just above are:

    // Create the page node type with revisions disabled.                       
    $page = NodeType::create([
      'type' => 'page',
      'new_revision' => FALSE,
    ]);
    $page->save();

    // Create the article node type with revisions disabled.                    
    $article = NodeType::create([
      'type' => 'article',
      'new_revision' => TRUE,
    ]);
    $article->save();

So it does look like a c/p mistake there

I checked later in the test to ensure the same mistake didn't recur:

    // Check the revision_log field on node 1 which has revisions disabled.     
    $may_update = $node1->revision_log->access('edit', $content_admin_user);
    $this->assertTrue($may_update, 'A user with permission "administer nodes" can edit the revision_log field when revisions are disabled.');
    $may_update = $node1->revision_log->access('edit', $page_creator_user);
    $this->assertFalse($may_update, 'A user without permission "administer nodes" can not edit the revision_log field when revisions are disabled.');

    // Check the revision_log field on node 2 which has revisions enabled.      
    $may_update = $node2->revision_log->access('edit', $content_admin_user);
    $this->assertTrue($may_update, 'A user with permission "administer nodes" can edit the revision_log field when revisions are enabled.');
    $may_update = $node2->revision_log->access('edit', $page_creator_user);
    $this->assertTrue($may_update, 'A user without permission "administer nodes" can edit the revision_log field when revisions are enabled.');

So this is indeed a complete fix on its own, and is not hiding any other bugs.

Committed to 10.1.x, and cherry-picked to 10.0.x and 9.5.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.