function EntityCreateAccessCheckTest::providerTestAccess

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php \Drupal\Tests\Core\Entity\EntityCreateAccessCheckTest::providerTestAccess()
  2. 10 core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php \Drupal\Tests\Core\Entity\EntityCreateAccessCheckTest::providerTestAccess()
  3. 11.x core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php \Drupal\Tests\Core\Entity\EntityCreateAccessCheckTest::providerTestAccess()

Provides test data for testAccess.

Return value

array

File

core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php, line 48

Class

EntityCreateAccessCheckTest
@coversDefaultClass \Drupal\Core\Entity\EntityCreateAccessCheck

Namespace

Drupal\Tests\Core\Entity

Code

public function providerTestAccess() {
    $no_access = FALSE;
    $access = TRUE;
    return [
        [
            '',
            'entity_test',
            $no_access,
            $no_access,
        ],
        [
            '',
            'entity_test',
            $access,
            $access,
        ],
        [
            'test_entity',
            'entity_test:test_entity',
            $access,
            $access,
        ],
        [
            'test_entity',
            'entity_test:test_entity',
            $no_access,
            $no_access,
        ],
        [
            'test_entity',
            'entity_test:{bundle_argument}',
            $access,
            $access,
        ],
        [
            'test_entity',
            'entity_test:{bundle_argument}',
            $no_access,
            $no_access,
        ],
        [
            '',
            'entity_test:{bundle_argument}',
            $no_access,
            $no_access,
            FALSE,
        ],
        // When the bundle is not provided, access should be denied even if the
        // access control handler would allow access.
[
            '',
            'entity_test:{bundle_argument}',
            $access,
            $no_access,
            FALSE,
        ],
    ];
}

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