function FileUploadTest::setUpAuthorization

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

Overrides ResourceTestBase::setUpAuthorization

13 calls to FileUploadTest::setUpAuthorization()
FileUploadTest::testFileUploadInvalidFileType in core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
Tests using the file upload route with an invalid file type.
FileUploadTest::testFileUploadLargerFileSize in core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
Tests using the file upload route with a file size larger than allowed.
FileUploadTest::testFileUploadMaliciousExtension in core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
Tests using the file upload POST route with malicious extensions.
FileUploadTest::testFileUploadNoDirectorySetting in core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
Tests using the file upload POST route no directory configured.
FileUploadTest::testFileUploadNoExtensionSetting in core/modules/jsonapi/tests/src/Functional/FileUploadTest.php
Tests using the file upload POST route no extension configured.

... See full list

File

core/modules/jsonapi/tests/src/Functional/FileUploadTest.php, line 892

Class

FileUploadTest
Tests binary data file upload route.

Namespace

Drupal\Tests\jsonapi\Functional

Code

protected function setUpAuthorization($method) {
    switch ($method) {
        case 'GET':
            $this->grantPermissionsToTestedRole([
                'view test entity',
            ]);
            break;
        case 'POST':
            $this->grantPermissionsToTestedRole([
                'create entity_test entity_test_with_bundle entities',
                'access content',
            ]);
            break;
        case 'PATCH':
            $this->grantPermissionsToTestedRole([
                'administer entity_test content',
                'access content',
            ]);
            break;
    }
}

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