You are here

public function FileSystemTest::testInvalidUTF8 in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/File/FileSystemTest.php \Drupal\Tests\Core\File\FileSystemTest::testInvalidUTF8()
  2. 9 core/tests/Drupal/Tests/Core/File/FileSystemTest.php \Drupal\Tests\Core\File\FileSystemTest::testInvalidUTF8()

Tests that invalid UTF-8 results in an exception.

@covers ::createFilename

File

core/tests/Drupal/Tests/Core/File/FileSystemTest.php, line 167

Class

FileSystemTest
@coversDefaultClass \Drupal\Core\File\FileSystem

Namespace

Drupal\Tests\Core\File

Code

public function testInvalidUTF8() {
  vfsStream::setup('dir');
  $filename = "" . '.txt';
  $this
    ->expectException(FileException::class);
  $this
    ->expectExceptionMessage("Invalid filename '{$filename}'");
  $this->fileSystem
    ->createFilename($filename, 'vfs://dir');
}