You are here

function FileNameMungingTest::testMungeIgnoreInsecure in Drupal 7

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

File

modules/simpletest/tests/file.test, line 2775
This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.

Class

FileNameMungingTest
Tests for file_munge_filename() and file_unmunge_filename().

Code

function testMungeIgnoreInsecure() {
  variable_set('allow_insecure_uploads', 1);
  $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,
  )));
}