function EntityCreateAccessCheckTest::providerTestAccess

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php \Drupal\Tests\Core\Entity\EntityCreateAccessCheckTest::providerTestAccess()
  2. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityCreateAccessCheckTest.php \Drupal\Tests\Core\Entity\EntityCreateAccessCheckTest::providerTestAccess()
  3. 10 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 50

Class

EntityCreateAccessCheckTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityCreateAccessCheck.php/class/EntityCreateAccessCheck/11.x" title="Defines an access checker for entity creation." class="local">\Drupal\Core\Entity\EntityCreateAccessCheck</a>

Namespace

Drupal\Tests\Core\Entity

Code

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