public function FileUploadSanitizeNameEventTest::testSetFilenameException in Drupal 9
@covers ::setFilename
File
- core/
tests/ Drupal/ Tests/ Core/ File/ FileUploadSanitizeNameEventTest.php, line 32
Class
- FileUploadSanitizeNameEventTest
- FileUploadSanitizeNameEvent tests.
Namespace
Drupal\Tests\Core\FileCode
public function testSetFilenameException() {
$event = new FileUploadSanitizeNameEvent('foo.txt', '');
$this
->assertSame('foo.txt', $event
->getFilename());
$this
->expectException(\InvalidArgumentException::class);
$this
->expectExceptionMessage('$filename must be a filename with no path information, "bar/foo.html" provided');
$event
->setFilename('bar/foo.html');
}