function LatestRevisionCheckTest::accessSituationProvider

Same name in other branches
  1. 9 core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php \Drupal\Tests\content_moderation\Unit\LatestRevisionCheckTest::accessSituationProvider()
  2. 8.9.x 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 108

Class

LatestRevisionCheckTest
@coversDefaultClass \Drupal\content_moderation\Access\LatestRevisionCheck @group content_moderation

Namespace

Drupal\Tests\content_moderation\Unit

Code

public static 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.