protected function RESTTestBase::entityPermissions

Provides the necessary user permissions for entity operations.

Parameters

string $entity_type: The entity type.

type $operation: The operation, one of 'view', 'create', 'update' or 'delete'.

Return value

array The set of user permission strings.

4 calls to RESTTestBase::entityPermissions()
CreateTest::testCreate in drupal/core/modules/rest/lib/Drupal/rest/Tests/CreateTest.php
Tests several valid and invalid create requests on all entity types.
DeleteTest::testDelete in drupal/core/modules/rest/lib/Drupal/rest/Tests/DeleteTest.php
Tests several valid and invalid delete requests on all entity types.
ReadTest::testRead in drupal/core/modules/rest/lib/Drupal/rest/Tests/ReadTest.php
Tests several valid and invalid read requests on all entity types.
UpdateTest::testPatchUpdate in drupal/core/modules/rest/lib/Drupal/rest/Tests/UpdateTest.php
Tests several valid and invalid partial update requests on test entities.

File

drupal/core/modules/rest/lib/Drupal/rest/Tests/RESTTestBase.php, line 256
Definition of Drupal\rest\test\RESTTestBase.

Class

RESTTestBase
Test helper class that provides a REST client method to send HTTP requests.

Namespace

Drupal\rest\Tests

Code

protected function entityPermissions($entity_type, $operation) {
  switch ($entity_type) {
    case 'entity_test':
      switch ($operation) {
        case 'view':
          return array(
            'view test entity',
          );
        case 'create':
        case 'update':
        case 'delete':
          return array(
            'administer entity_test content',
          );
      }
  }
}