function LatestRevisionCheckTest::accessSituationProvider

Same name and namespace in other branches
  1. 8.9.x core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php \Drupal\Tests\content_moderation\Unit\LatestRevisionCheckTest::accessSituationProvider()
  2. 10 core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php \Drupal\Tests\content_moderation\Unit\LatestRevisionCheckTest::accessSituationProvider()
  3. 11.x core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php \Drupal\Tests\content_moderation\Unit\LatestRevisionCheckTest::accessSituationProvider()

Data provider for testLastAccessPermissions().

File

core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php, line 106

Class

LatestRevisionCheckTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21content_moderation%21src%21Access%21LatestRevisionCheck.php/class/LatestRevisionCheck/9" title="Access check for the entity moderation tab." class="local">\Drupal\content_moderation\Access\LatestRevisionCheck</a> @group content_moderation

Namespace

Drupal\Tests\content_moderation\Unit

Code

public function accessSituationProvider() {
    return [
        // Node with global permissions and latest version.
[
            Node::class,
            'node',
            TRUE,
            [
                'view latest version',
                'view any unpublished content',
            ],
            FALSE,
            AccessResultAllowed::class,
        ],
        // Node with global permissions and no latest version.
[
            Node::class,
            'node',
            FALSE,
            [
                'view latest version',
                'view any unpublished content',
            ],
            FALSE,
            AccessResultForbidden::class,
        ],
        // Node with own content permissions and latest version.
[
            Node::class,
            'node',
            TRUE,
            [
                'view latest version',
                'view own unpublished content',
            ],
            TRUE,
            AccessResultAllowed::class,
        ],
        // Node with own content permissions and no latest version.
[
            Node::class,
            'node',
            FALSE,
            [
                'view latest version',
                'view own unpublished content',
            ],
            FALSE,
            AccessResultForbidden::class,
        ],
        // Node with own content permissions and latest version, but no perms to
        // view latest version.
[
            Node::class,
            'node',
            TRUE,
            [
                'view own unpublished content',
            ],
            TRUE,
            AccessResultNeutral::class,
        ],
        // Node with own content permissions and no latest version, but no perms
        // to view latest version.
[
            Node::class,
            'node',
            TRUE,
            [
                'view own unpublished content',
            ],
            FALSE,
            AccessResultNeutral::class,
        ],
        // Block with pending revision, and permissions to view any.
[
            BlockContent::class,
            'block_content',
            TRUE,
            [
                'view latest version',
                'view any unpublished content',
            ],
            FALSE,
            AccessResultAllowed::class,
        ],
        // Block with no pending revision.
[
            BlockContent::class,
            'block_content',
            FALSE,
            [
                'view latest version',
                'view any unpublished content',
            ],
            FALSE,
            AccessResultForbidden::class,
        ],
        // Block with pending revision, but no permission to view any.
[
            BlockContent::class,
            'block_content',
            TRUE,
            [
                'view latest version',
                'view own unpublished content',
            ],
            FALSE,
            AccessResultNeutral::class,
        ],
        // Block with no pending revision.
[
            BlockContent::class,
            'block_content',
            FALSE,
            [
                'view latest version',
                'view own unpublished content',
            ],
            FALSE,
            AccessResultForbidden::class,
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.