Moving or removing the "files" directory from the "sites/[site-name]/" directory causes the following warnings:

  • scandir(sites/www.example.com/files/simpletest885180) [function.scandir]: failed to open dir: No such file or directory
    simpletest.module / 613 / simpletest_clean_temporary_directory()
  • scandir() [function.scandir]: (errno 2): No such file or directory
    simpletest.module / 613 / simpletest_clean_temporary_directory()
  • Invalid argument supplied for foreach()
    simpletest.module / 614 / simpletest_clean_temporary_directory()
  • rmdir(sites/www.example.com/files/simpletest885180) [function.rmdir]: No such file or directory
    simpletest.module / 626 / simpletest_clean_temporary_directory()

I believe the following is happening:

In class DrupalWebTestCase setUp() (drupal_web_test_case.php):

  • When drupal_install_system() is called the system variable "file_directory_path" is set to: sites/[site-name]/files
    (e.g., sites/www.example.com/files)
  • The "file_directory_path" variable is then set to use the same prefix as the database
    variable_set('file_directory_path', file_directory_path() . '/' . $db_prefix);
    (e.g., sites/www.example.com/files/simpletest885180)
  • The temporary directory is then created with:
        $directory = file_directory_path();
        file_check_directory($directory, FILE_CREATE_DIRECTORY); // Create the files directory.
    
  • If the "files" directory is moved or removed, then only the path "sites/www.example.com" exists. The attempt to create "sites/www.example.com/files/simpletest885180" silently fails because there is no parent "files" directory.

A work-around for the problem is insuring a "sites/[site-name]/files" directory exists, regardless of the real files path.

Comments

boombatower’s picture

Status: Active » Postponed (maintainer needs more info)

Seems like this is duplicate?

#335756: SimpleTest: $this->originalFileDirectory should be set before installation to ensure non-standard directories are picked up

If so lets link to this for another report in the other issue and mark this as a duplicate.

dale42’s picture

Yes, that looks like same issue to me.

dale42’s picture

Status: Postponed (maintainer needs more info) » Closed (duplicate)