function ResourceTestBase::provisionResource
Same name in other branches
- 9 core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::provisionResource()
- 8.9.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::provisionResource()
- 11.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::provisionResource()
Provisions the REST resource under test.
Parameters
string[] $formats: The allowed formats for this resource.
string[] $authentication: The allowed authentication providers for this resource.
string[] $methods: The allowed methods for this resource.
16 calls to ResourceTestBase::provisionResource()
- DbLogResourceTest::setUp in core/
modules/ dblog/ tests/ src/ Functional/ DbLogResourceTest.php - EntityResourceTestBase::provisionEntityResource in core/
modules/ rest/ tests/ src/ Functional/ EntityResource/ EntityResourceTestBase.php - Provides an entity resource.
- FileUploadResourceTestBase::testFileUploadInvalidFileType in core/
modules/ rest/ tests/ src/ Functional/ FileUploadResourceTestBase.php - Tests using the file upload route with an invalid file type.
- FileUploadResourceTestBase::testFileUploadLargerFileSize in core/
modules/ rest/ tests/ src/ Functional/ FileUploadResourceTestBase.php - Tests using the file upload route with a file size larger than allowed.
- FileUploadResourceTestBase::testFileUploadMaliciousExtension in core/
modules/ rest/ tests/ src/ Functional/ FileUploadResourceTestBase.php - Tests using the file upload POST route with malicious extensions.
File
-
core/
modules/ rest/ tests/ src/ Functional/ ResourceTestBase.php, line 149
Class
- ResourceTestBase
- Subclass this for every REST resource, every format and every auth provider.
Namespace
Drupal\Tests\rest\FunctionalCode
protected function provisionResource($formats = [], $authentication = [], array $methods = [
'GET',
'POST',
'PATCH',
'DELETE',
]) {
$this->resourceConfigStorage
->create([
'id' => static::$resourceConfigId,
'granularity' => RestResourceConfigInterface::RESOURCE_GRANULARITY,
'configuration' => [
'methods' => $methods,
'formats' => $formats,
'authentication' => $authentication,
],
'status' => TRUE,
])
->save();
$this->refreshTestStateAfterRestConfigChange();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.