Download & Extend

Set a testing temp directory as well as public/private

Project:Drupal core
Version:7.x-dev
Component:simpletest.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

Some tests such as those for file uploads use the tempory:// URI. However, we don't set a testing temp directory, so test results may be incorrect if a previously saved file still exists.
Also, we shoudl double-check this code in the tests setUp() mehtod, since it looks a little odd still:

    // Use temporary files directory with the same prefix as the database.
    $public_files_directory  = $this->originalFileDirectory . '/' . $db_prefix;
    $private_files_directory = $public_files_directory . '/private';

    // Set path variables
    variable_set('file_public_path', $public_files_directory);
    variable_set('file_private_path', $private_files_directory);

    // Create the directories
    $directory = file_directory_path('public');
    file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
    file_prepare_directory($private_files_directory, FILE_CREATE_DIRECTORY);

Comments

#1

A fix is included in the patch for #616162: Simpletest leaves files behind.

#2

Status:active» closed (duplicate)

this is being handled here: #577398: Ensure test coverage of simpletest temporary file handling

nobody click here