function NameMungingTest::testMungeNullByte

Same name in other branches
  1. 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\File

Code

public function testMungeNullByte() {
    $prefix = $this->randomMachineName();
    $filename = $prefix . '.' . $this->badExtension . "\x00.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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.