Skip to content
Snippets Groups Projects
Commit b8f20997 authored by Angie Byron's avatar Angie Byron
Browse files

#667410 by justinrandell: Fixed simpletest doesn't create a temporary files directory.

parent c19b7667
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -1082,10 +1082,12 @@ protected function setUp() { ...@@ -1082,10 +1082,12 @@ protected function setUp() {
// Use temporary files directory with the same prefix as the database. // Use temporary files directory with the same prefix as the database.
$public_files_directory = $this->originalFileDirectory . '/simpletest/' . substr($db_prefix, 10); $public_files_directory = $this->originalFileDirectory . '/simpletest/' . substr($db_prefix, 10);
$private_files_directory = $public_files_directory . '/private'; $private_files_directory = $public_files_directory . '/private';
$temp_files_directory = $private_files_directory . '/temp';
// Create the directories // Create the directories
file_prepare_directory($public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS); file_prepare_directory($public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
file_prepare_directory($private_files_directory, FILE_CREATE_DIRECTORY); file_prepare_directory($private_files_directory, FILE_CREATE_DIRECTORY);
file_prepare_directory($temp_files_directory, FILE_CREATE_DIRECTORY);
// Log fatal errors. // Log fatal errors.
ini_set('log_errors', 1); ini_set('log_errors', 1);
...@@ -1150,6 +1152,7 @@ protected function setUp() { ...@@ -1150,6 +1152,7 @@ protected function setUp() {
// Set path variables // Set path variables
variable_set('file_public_path', $public_files_directory); variable_set('file_public_path', $public_files_directory);
variable_set('file_private_path', $private_files_directory); variable_set('file_private_path', $private_files_directory);
variable_set('file_temporary_path', $temp_files_directory);
// Use the test mail class instead of the default mail handler class. // Use the test mail class instead of the default mail handler class.
variable_set('mail_system', array('default-system' => 'TestingMailSystem')); variable_set('mail_system', array('default-system' => 'TestingMailSystem'));
......
...@@ -2195,7 +2195,7 @@ class StreamWrapperTest extends DrupalWebTestCase { ...@@ -2195,7 +2195,7 @@ class StreamWrapperTest extends DrupalWebTestCase {
$this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', t('Expected scheme was added.')); $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', t('Expected scheme was added.'));
$this->assertEqual(file_directory_path(), variable_get('file_public_path'), t('Expected default directory path was returned.')); $this->assertEqual(file_directory_path(), variable_get('file_public_path'), t('Expected default directory path was returned.'));
$this->assertEqual(file_directory_path('public'), variable_get('file_public_path'), t('Expected public directory path was returned.')); $this->assertEqual(file_directory_path('public'), variable_get('file_public_path'), t('Expected public directory path was returned.'));
$this->assertEqual(file_directory_path('temporary'), conf_path() . '/private/temp', t('Expected temporary directory path was returned.')); $this->assertEqual(file_directory_path('temporary'), variable_get('file_temporary_path'), t('Expected temporary directory path was returned.'));
$this->assertEqual(file_directory_path($this->scheme), variable_get('stream_public_path', 'sites/default/files'), t('Expected dummy directory path was returned.')); $this->assertEqual(file_directory_path($this->scheme), variable_get('stream_public_path', 'sites/default/files'), t('Expected dummy directory path was returned.'));
$this->assertFalse(file_directory_path('non-existent'), t('No directory path returned for invalid scheme.')); $this->assertFalse(file_directory_path('non-existent'), t('No directory path returned for invalid scheme.'));
variable_set('file_default_scheme', 'private'); variable_set('file_default_scheme', 'private');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment