function PermissionAccessCheckTest::providerTestAccess

Same name in other branches
  1. 9 core/modules/user/tests/src/Unit/PermissionAccessCheckTest.php \Drupal\Tests\user\Unit\PermissionAccessCheckTest::providerTestAccess()
  2. 8.9.x core/modules/user/tests/src/Unit/PermissionAccessCheckTest.php \Drupal\Tests\user\Unit\PermissionAccessCheckTest::providerTestAccess()
  3. 11.x core/modules/user/tests/src/Unit/PermissionAccessCheckTest.php \Drupal\Tests\user\Unit\PermissionAccessCheckTest::providerTestAccess()

Provides data for the testAccess method.

Return value

array

File

core/modules/user/tests/src/Unit/PermissionAccessCheckTest.php, line 56

Class

PermissionAccessCheckTest
@coversDefaultClass \Drupal\user\Access\PermissionAccessCheck @group Routing @group Access

Namespace

Drupal\Tests\user\Unit

Code

public static function providerTestAccess() {
    return [
        [
            [],
            FALSE,
        ],
        [
            [
                '_permission' => 'allowed',
            ],
            TRUE,
            [
                'user.permissions',
            ],
        ],
        [
            [
                '_permission' => 'denied',
            ],
            FALSE,
            [
                'user.permissions',
            ],
            "The 'denied' permission is required.",
        ],
        [
            [
                '_permission' => 'allowed+denied',
            ],
            TRUE,
            [
                'user.permissions',
            ],
        ],
        [
            [
                '_permission' => 'allowed+denied+other',
            ],
            TRUE,
            [
                'user.permissions',
            ],
        ],
        [
            [
                '_permission' => 'allowed,denied',
            ],
            FALSE,
            [
                'user.permissions',
            ],
            "The following permissions are required: 'allowed' AND 'denied'.",
        ],
    ];
}

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