function ContentDispositionFilenameParserTest::testParseFilenameInvalid

Same name in other branches
  1. 11.x core/modules/file/tests/src/Unit/Upload/ContentDispositionFilenameParserTest.php \Drupal\Tests\file\Unit\Upload\ContentDispositionFilenameParserTest::testParseFilenameInvalid()

@covers ::parseFilename @dataProvider invalidHeaderProvider

File

core/modules/file/tests/src/Unit/Upload/ContentDispositionFilenameParserTest.php, line 35

Class

ContentDispositionFilenameParserTest
Tests the ContentDispositionFilenameParser class.

Namespace

Drupal\Tests\file\Unit\Upload

Code

public function testParseFilenameInvalid(string|bool $contentDisposition) : void {
    $this->expectException(BadRequestHttpException::class);
    $this->expectExceptionMessage('No filename found in "Content-Disposition" header. A file name in the format "filename=FILENAME" must be provided.');
    $request = $this->createRequest($contentDisposition);
    ContentDispositionFilenameParser::parseFilename($request);
}

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