function NameMungingTest::testMungeNullByte

Tests munging with a null byte in the filename.

File

drupal/core/modules/system/lib/Drupal/system/Tests/File/NameMungingTest.php, line 43
Definition of Drupal\system\Tests\File\NameMungingTest.

Class

NameMungingTest
Tests for file_munge_filename() and file_unmunge_filename().

Namespace

Drupal\system\Tests\File

Code

function testMungeNullByte() {
  $prefix = $this
    ->randomName();
  $filename = $prefix . '.' . $this->bad_extension . "\0.txt";
  $this
    ->assertEqual(file_munge_filename($filename, ''), $prefix . '.' . $this->bad_extension . '_.txt', 'A filename with a null byte is correctly munged to remove the null byte.');
}