1 file.test FileDirectoryTest::testFileDirectoryTemp()

Ensure that the file_directory_temp() function always returns a value.

File

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

Class

FileDirectoryTest
Directory related tests.

Code

function testFileDirectoryTemp() {
  // Start with an empty config to ensure we have a clean slate.
  config_set('system.core', 'file_temporary_path', '');
  $tmp_directory = file_directory_temp();
  $this->assertEqual(empty($tmp_directory), FALSE, 'file_directory_temp() returned a non-empty value.');

  // Set to a specific value.
  $setting = '/tmp';
  config_set('system.core', 'file_temporary_path', $setting);
  $tmp_directory = file_directory_temp();
  $this->assertEqual($setting, $tmp_directory, "The 'file_temporary_path' config setting has the same value that file_directory_temp() returned.");
}