public function FileUploadResourceTestBase::testFileUploadNoExtensionSetting in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php \Drupal\Tests\rest\Functional\FileUploadResourceTestBase::testFileUploadNoExtensionSetting()
- 9 core/modules/rest/tests/src/Functional/FileUploadResourceTestBase.php \Drupal\Tests\rest\Functional\FileUploadResourceTestBase::testFileUploadNoExtensionSetting()
Tests using the file upload POST route no extension configured.
File
- core/
modules/ rest/ tests/ src/ Functional/ FileUploadResourceTestBase.php, line 630
Class
- FileUploadResourceTestBase
- Tests binary data file upload route.
Namespace
Drupal\Tests\rest\FunctionalCode
public function testFileUploadNoExtensionSetting() {
$this
->initAuthentication();
$this
->provisionResource([
static::$format,
], static::$auth ? [
static::$auth,
] : [], [
'POST',
]);
$this
->setUpAuthorization('POST');
$uri = Url::fromUri('base:' . static::$postUri);
$this->field
->setSetting('file_extensions', '')
->save();
$this
->refreshTestStateAfterRestConfigChange();
$response = $this
->fileRequest($uri, $this->testFileData, [
'Content-Disposition' => 'filename="example.txt"',
]);
$expected = $this
->getExpectedNormalizedEntity(1, 'example.txt', TRUE);
$this
->assertResponseData($expected, $response);
$this
->assertFileExists('public://foobar/example.txt');
}