From 57759f5a8ddc85231ea2ab61d707a062dbaae000 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 5 Oct 2010 06:23:18 +0000 Subject: #930122 by dww: Regression: temp directory handling broken by confusion between file_directory_temp and file_temporary_path. --- modules/simpletest/tests/file.test | 13 ++++++++++++- modules/system/system.module | 7 ++++--- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test index 94a65938e..36a7170b2 100644 --- a/modules/simpletest/tests/file.test +++ b/modules/simpletest/tests/file.test @@ -972,8 +972,19 @@ class FileDirectoryTest extends FileTestCase { $path = file_destination($destination, FILE_EXISTS_ERROR); $this->assertEqual($path, FALSE, t('An error is returned when filepath destination already exists with FILE_EXISTS_ERROR.'), 'File'); } -} + /** + * Ensure that the file_directory_temp() function always returns a value. + */ + function testFileDirectoryTemp() { + // Start with an empty variable to ensure we have a clean slate. + variable_set('file_temporary_path', ''); + $tmp_directory = file_directory_temp(); + $this->assertEqual(empty($tmp_directory), FALSE, t('file_directory_temp() returned a non-empty value.')); + $setting = variable_get('file_temporary_path', ''); + $this->assertEqual($setting, $tmp_directory, t("The 'file_temporary_path' variable has the same value that file_directory_temp() returned.")); + } +} /** * Tests the file_scan_directory() function. diff --git a/modules/system/system.module b/modules/system/system.module index bfbdc285c..08d2010cc 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -2069,9 +2069,10 @@ function system_admin_menu_block($item) { } /** - * Checks the existence of the directory specified in $form_element. This - * function is called from the system_settings form to check both core file - * directories (file_public_path, file_private_path, file_temporary_path). + * Checks the existence of the directory specified in $form_element. + * + * This function is called from the system_settings form to check all core + * file directories (file_public_path, file_private_path, file_temporary_path). * * @param $form_element * The form element containing the name of the directory to check. -- cgit v1.2.3