You are here

public function PermissionAccessCheckTest::providerTestAccess in Drupal 8

Same name and namespace in other branches
  1. 9 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 54

Class

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

Namespace

Drupal\Tests\user\Unit

Code

public 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'.",
    ],
  ];
}