You are here

public function EntityCreateAccessCheckTest::providerTestAccess in Drupal 8

Same name and namespace in other branches
  1. 9 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,
    ],
  ];
}