public function NameMungingTest::testMungeNullByte in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/File/NameMungingTest.php \Drupal\KernelTests\Core\File\NameMungingTest::testMungeNullByte()
Tests munging with a null byte in the filename.
File
- core/
tests/ Drupal/ KernelTests/ Core/ File/ NameMungingTest.php, line 75
Class
- NameMungingTest
- Tests filename munging and unmunging.
Namespace
Drupal\KernelTests\Core\FileCode
public function testMungeNullByte() {
$prefix = $this
->randomMachineName();
$filename = $prefix . '.' . $this->badExtension . "\0.txt";
$this
->assertEqual(file_munge_filename($filename, ''), $prefix . '.' . $this->badExtension . '_.txt', 'A filename with a null byte is correctly munged to remove the null byte.');
}