function UserSessionTest::providerTestHasPermission

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Session/UserSessionTest.php \Drupal\Tests\Core\Session\UserSessionTest::providerTestHasPermission()
  2. 10 core/tests/Drupal/Tests/Core/Session/UserSessionTest.php \Drupal\Tests\Core\Session\UserSessionTest::providerTestHasPermission()

Provides test data for getHasPermission().

Return value

array

File

core/tests/Drupal/Tests/Core/Session/UserSessionTest.php, line 29

Class

UserSessionTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Session%21UserSession.php/class/UserSession/9" title="An implementation of the user account interface for the global user." class="local">\Drupal\Core\Session\UserSession</a> @group Session

Namespace

Drupal\Tests\Core\Session

Code

public function providerTestHasPermission() {
    $data = [];
    $data[] = [
        'example permission',
        [
            'user_one',
            'user_two',
        ],
        [
            'user_last',
        ],
    ];
    $data[] = [
        'another example permission',
        [
            'user_two',
        ],
        [
            'user_one',
            'user_last',
        ],
    ];
    $data[] = [
        'final example permission',
        [],
        [
            'user_one',
            'user_two',
            'user_last',
        ],
    ];
    return $data;
}

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