function MediaTest::getExpectedUnauthorizedAccessMessage

Same name in other branches
  1. 8.9.x core/modules/jsonapi/tests/src/Functional/MediaTest.php \Drupal\Tests\jsonapi\Functional\MediaTest::getExpectedUnauthorizedAccessMessage()
  2. 10 core/modules/jsonapi/tests/src/Functional/MediaTest.php \Drupal\Tests\jsonapi\Functional\MediaTest::getExpectedUnauthorizedAccessMessage()
  3. 11.x core/modules/jsonapi/tests/src/Functional/MediaTest.php \Drupal\Tests\jsonapi\Functional\MediaTest::getExpectedUnauthorizedAccessMessage()

Overrides ResourceTestBase::getExpectedUnauthorizedAccessMessage

File

core/modules/jsonapi/tests/src/Functional/MediaTest.php, line 322

Class

MediaTest
JSON:API integration test for the "Media" content entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function getExpectedUnauthorizedAccessMessage($method) {
    switch ($method) {
        case 'GET':
            return "The 'view media' permission is required when the media item is published.";
        case 'POST':
            return "The following permissions are required: 'administer media' OR 'create media' OR 'create camelids media'.";
        case 'PATCH':
            return "The following permissions are required: 'update any media' OR 'update own media' OR 'camelids: edit any media' OR 'camelids: edit own media'.";
        case 'DELETE':
            return "The following permissions are required: 'delete any media' OR 'delete own media' OR 'camelids: delete any media' OR 'camelids: delete own media'.";
        default:
            return '';
    }
}

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