You are here

function NameMungingTest::testMungeIgnoreInsecure in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/File/NameMungingTest.php \Drupal\system\Tests\File\NameMungingTest::testMungeIgnoreInsecure()

If the system.file.allow_insecure_uploads setting evaluates to true, the file should come out untouched, no matter how evil the filename.

File

core/modules/system/src/Tests/File/NameMungingTest.php, line 64
Contains \Drupal\system\Tests\File\NameMungingTest.

Class

NameMungingTest
Tests filename munging and unmunging.

Namespace

Drupal\system\Tests\File

Code

function testMungeIgnoreInsecure() {
  $this
    ->config('system.file')
    ->set('allow_insecure_uploads', 1)
    ->save();
  $munged_name = file_munge_filename($this->name, '');
  $this
    ->assertIdentical($munged_name, $this->name, format_string('The original filename (%original) matches the munged filename (%munged) when insecure uploads are enabled.', array(
    '%munged' => $munged_name,
    '%original' => $this->name,
  )));
}