function FileUploadTest::testFileUploadUnicodeFilename
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::testFileUploadUnicodeFilename()
- 10 core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::testFileUploadUnicodeFilename()
- 11.x core/modules/jsonapi/tests/src/Functional/FileUploadTest.php \Drupal\Tests\jsonapi\Functional\FileUploadTest::testFileUploadUnicodeFilename()
Tests using the file upload route with a unicode file name.
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ FileUploadTest.php, line 527
Class
- FileUploadTest
- Tests binary data file upload route.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
public function testFileUploadUnicodeFilename() {
$this->setUpAuthorization('POST');
$this->config('jsonapi.settings')
->set('read_only', FALSE)
->save(TRUE);
$uri = Url::fromUri('base:' . static::$postUri);
// It is important that the filename starts with a unicode character. See
// https://bugs.php.net/bug.php?id=77239.
$response = $this->fileRequest($uri, $this->testFileData, [
'Content-Disposition' => 'file; filename="Èxample-✓.txt"',
]);
$this->assertSame(201, $response->getStatusCode());
$expected = $this->getExpectedDocument(1, 'Èxample-✓.txt', TRUE);
$this->assertResponseData($expected, $response);
$this->assertSame($this->testFileData, file_get_contents('public://foobar/Èxample-✓.txt'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.