function NameMungingTest::testMungeIgnoreWhitelisted 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::testMungeIgnoreWhitelisted()
White listed extensions are ignored by file_munge_filename().
File
- core/
modules/ system/ src/ Tests/ File/ NameMungingTest.php, line 73 - Contains \Drupal\system\Tests\File\NameMungingTest.
Class
- NameMungingTest
- Tests filename munging and unmunging.
Namespace
Drupal\system\Tests\FileCode
function testMungeIgnoreWhitelisted() {
// Declare our extension as whitelisted. The declared extensions should
// be case insensitive so test using one with a different case.
$munged_name = file_munge_filename($this->nameWithUcExt, $this->badExtension);
$this
->assertIdentical($munged_name, $this->nameWithUcExt, format_string('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', array(
'%munged' => $munged_name,
'%original' => $this->nameWithUcExt,
)));
// The allowed extensions should also be normalized.
$munged_name = file_munge_filename($this->name, strtoupper($this->badExtension));
$this
->assertIdentical($munged_name, $this->name, format_string('The new filename (%munged) matches the original (%original) also when the whitelisted extension is in uppercase.', array(
'%munged' => $munged_name,
'%original' => $this->name,
)));
}