function NameMungingTest::testMungeNullByte in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/File/NameMungingTest.php \Drupal\system\Tests\File\NameMungingTest::testMungeNullByte()
Tests munging with a null byte in the filename.
File
- core/
modules/ system/ src/ Tests/ File/ NameMungingTest.php, line 54 - Contains \Drupal\system\Tests\File\NameMungingTest.
Class
- NameMungingTest
- Tests filename munging and unmunging.
Namespace
Drupal\system\Tests\FileCode
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.');
}