diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/blogapi/blogapi.test | 2 | ||||
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 6 | ||||
-rw-r--r-- | modules/simpletest/simpletest.install | 2 | ||||
-rw-r--r-- | modules/simpletest/simpletest.module | 2 | ||||
-rw-r--r-- | modules/simpletest/tests/file.test | 36 | ||||
-rw-r--r-- | modules/system/system.module | 16 | ||||
-rw-r--r-- | modules/update/update.compare.inc | 2 | ||||
-rw-r--r-- | modules/upload/upload.test | 10 | ||||
-rw-r--r-- | modules/user/user.test | 24 |
9 files changed, 51 insertions, 49 deletions
diff --git a/modules/blogapi/blogapi.test b/modules/blogapi/blogapi.test index 14242d122..dd0d72ee6 100644 --- a/modules/blogapi/blogapi.test +++ b/modules/blogapi/blogapi.test @@ -68,7 +68,7 @@ class BlogAPITestCase extends DrupalWebTestCase { // Upload file. $file = current($this->drupalGetTestFiles('text')); - $file_contents = file_get_contents($file->filename); + $file_contents = file_get_contents($file->filepath); $file = array(); $file['name'] = $this->randomName() . '.txt'; $file['type'] = 'text'; diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index cd8b16216..062fb6531 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -593,9 +593,9 @@ class DrupalWebTestCase { // If size is set then remove any files that are not of that size. if ($size !== NULL) { foreach ($files as $file) { - $stats = stat($file->filename); + $stats = stat($file->filepath); if ($stats['size'] != $size) { - unset($files[$file->filename]); + unset($files[$file->filepath]); } } } @@ -609,7 +609,7 @@ class DrupalWebTestCase { */ protected function drupalCompareFiles($file1, $file2) { // Determine which file is larger. - $compare_size = (filesize($file1->filename) > filesize($file2->filename)); + $compare_size = (filesize($file1->filepath) > filesize($file2->filepath)); if (!$compare_size) { // Both files were the same size, so return whichever one is alphabetically greater. return strnatcmp($file1->name, $file2->name); diff --git a/modules/simpletest/simpletest.install b/modules/simpletest/simpletest.install index 2aa13e926..94a8d6960 100644 --- a/modules/simpletest/simpletest.install +++ b/modules/simpletest/simpletest.install @@ -33,7 +33,7 @@ function simpletest_install() { $original = drupal_get_path('module', 'simpletest') . '/files'; $files = file_scan_directory($original, '/(html|image|javascript|php|sql)-.*/'); foreach ($files as $file) { - file_unmanaged_copy($file->filename, $path . '/' . $file->basename); + file_unmanaged_copy($file->filepath, $path); } $generated = TRUE; } diff --git a/modules/simpletest/simpletest.module b/modules/simpletest/simpletest.module index fe3127758..f0ab28fd7 100644 --- a/modules/simpletest/simpletest.module +++ b/modules/simpletest/simpletest.module @@ -465,7 +465,7 @@ function simpletest_get_all_tests() { $tests_directory = $module_path . '/tests'; if (is_dir($tests_directory)) { foreach (file_scan_directory($tests_directory, '/\.test$/') as $file) { - $files[] = $file->filename; + $files[] = $file->filepath; } } } diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test index 2935bfd18..09a75b78e 100644 --- a/modules/simpletest/tests/file.test +++ b/modules/simpletest/tests/file.test @@ -21,14 +21,14 @@ function file_test_validator($file, $errors) { * When the function is called with $reset parameter TRUE the cache is cleared * and the results returned. * - * @param $file - * File object + * @param $filepath + * File path * @param $reset * Boolean indicating that the stored files should be removed and returned. * @return * An array of all previous $file parameters since $reset was last called. */ -function file_test_file_scan_callback($file, $reset = FALSE) { +function file_test_file_scan_callback($filepath, $reset = FALSE) { static $files = array(); if ($reset) { @@ -37,7 +37,7 @@ function file_test_file_scan_callback($file, $reset = FALSE) { return $ret; } - $files[] = $file; + $files[] = $filepath; } /** @@ -525,14 +525,14 @@ class FileSaveUploadTest extends FileHookTestCase { $this->drupalLogin($account); $this->image = current($this->drupalGetTestFiles('image')); - $this->assertTrue(is_file($this->image->filename), t("The file we're going to upload exists.")); + $this->assertTrue(is_file($this->image->filepath), t("The file we're going to upload exists.")); $this->maxFidBefore = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchField(); // Upload with replace to gurantee there's something there. $edit = array( 'file_test_replace' => FILE_EXISTS_REPLACE, - 'files[file_test_upload]' => realpath($this->image->filename) + 'files[file_test_upload]' => realpath($this->image->filepath) ); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); @@ -559,7 +559,7 @@ class FileSaveUploadTest extends FileHookTestCase { // Upload a second file. $max_fid_before = db_query('SELECT MAX(fid) AS fid FROM {files}')->fetchField(); $image2 = current($this->drupalGetTestFiles('image')); - $edit = array('files[file_test_upload]' => realpath($image2->filename)); + $edit = array('files[file_test_upload]' => realpath($image2->filepath)); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); $this->assertRaw(t('You WIN!')); @@ -584,7 +584,7 @@ class FileSaveUploadTest extends FileHookTestCase { function testExistingRename() { $edit = array( 'file_test_replace' => FILE_EXISTS_RENAME, - 'files[file_test_upload]' => realpath($this->image->filename) + 'files[file_test_upload]' => realpath($this->image->filepath) ); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); @@ -600,7 +600,7 @@ class FileSaveUploadTest extends FileHookTestCase { function testExistingReplace() { $edit = array( 'file_test_replace' => FILE_EXISTS_REPLACE, - 'files[file_test_upload]' => realpath($this->image->filename) + 'files[file_test_upload]' => realpath($this->image->filepath) ); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); @@ -616,7 +616,7 @@ class FileSaveUploadTest extends FileHookTestCase { function testExistingError() { $edit = array( 'file_test_replace' => FILE_EXISTS_ERROR, - 'files[file_test_upload]' => realpath($this->image->filename) + 'files[file_test_upload]' => realpath($this->image->filepath) ); $this->drupalPost('file-test/upload', $edit, t('Submit')); $this->assertResponse(200, t('Received a 200 response for posted test file.')); @@ -829,16 +829,16 @@ class FileScanDirectoryTest extends FileTestCase { // Check the first file. $file = reset($all_files); - $this->assertEqual(key($all_files), $file->filename, t('Correct array key was used for the first returned file.')); - $this->assertEqual($file->filename, $this->path . '/javascript-1.txt', t('First file name was set correctly.')); - $this->assertEqual($file->basename, 'javascript-1.txt', t('First basename was set correctly')); + $this->assertEqual(key($all_files), $file->filepath, t('Correct array key was used for the first returned file.')); + $this->assertEqual($file->filepath, $this->path . '/javascript-1.txt', t('First file name was set correctly.')); + $this->assertEqual($file->filename, 'javascript-1.txt', t('First basename was set correctly')); $this->assertEqual($file->name, 'javascript-1', t('First name was set correctly.')); // Check the second file. $file = next($all_files); - $this->assertEqual(key($all_files), $file->filename, t('Correct array key was used for the second returned file.')); - $this->assertEqual($file->filename, $this->path . '/javascript-2.script', t('Second file name was set correctly.')); - $this->assertEqual($file->basename, 'javascript-2.script', t('Second basename was set correctly')); + $this->assertEqual(key($all_files), $file->filepath, t('Correct array key was used for the second returned file.')); + $this->assertEqual($file->filepath, $this->path . '/javascript-2.script', t('Second file name was set correctly.')); + $this->assertEqual($file->filename, 'javascript-2.script', t('Second basename was set correctly')); $this->assertEqual($file->name, 'javascript-2', t('Second name was set correctly.')); } @@ -879,13 +879,13 @@ class FileScanDirectoryTest extends FileTestCase { function testOptionKey() { // "filename", for the path starting with $dir. $expected = array($this->path . '/javascript-1.txt', $this->path . '/javascript-2.script'); - $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'filename'))); + $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'filepath'))); sort($actual); $this->assertEqual($expected, $actual, t('Returned the correct values for the filename key.')); // "basename", for the basename of the file. $expected = array('javascript-1.txt', 'javascript-2.script'); - $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'basename'))); + $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'filename'))); sort($actual); $this->assertEqual($expected, $actual, t('Returned the correct values for the basename key.')); diff --git a/modules/system/system.module b/modules/system/system.module index f4f0ca744..ef9bd565f 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -1062,7 +1062,8 @@ function system_get_files_database(&$files, $type) { $result = db_query("SELECT filename, name, type, status, schema_version, weight FROM {system} WHERE type = '%s'", $type); while ($file = db_fetch_object($result)) { if (isset($files[$file->name]) && is_object($files[$file->name])) { - $file->old_filename = $file->filename; + $file->filepath = $file->filename; + $file->old_filepath = $file->filepath; foreach ($file as $key => $value) { if (!isset($files[$file->name]) || !isset($files[$file->name]->$key)) { $files[$file->name]->$key = $value; @@ -1155,7 +1156,8 @@ function _system_theme_data() { $sub_themes = array(); // Read info files for each theme foreach ($themes as $key => $theme) { - $themes[$key]->info = drupal_parse_info_file($theme->filename) + $defaults; + $themes[$key]->filename = $theme->filepath; + $themes[$key]->info = drupal_parse_info_file($theme->filepath) + $defaults; // Invoke hook_system_info_alter() to give installed modules a chance to // modify the data in the .info files if necessary. @@ -1165,7 +1167,7 @@ function _system_theme_data() { $sub_themes[] = $key; } if (empty($themes[$key]->info['engine'])) { - $filename = dirname($themes[$key]->filename) . '/' . $themes[$key]->name . '.theme'; + $filename = dirname($themes[$key]->filepath) . '/' . $themes[$key]->name . '.theme'; if (file_exists($filename)) { $themes[$key]->owner = $filename; $themes[$key]->prefix = $key; @@ -1174,7 +1176,7 @@ function _system_theme_data() { else { $engine = $themes[$key]->info['engine']; if (isset($engines[$engine])) { - $themes[$key]->owner = $engines[$engine]->filename; + $themes[$key]->owner = $engines[$engine]->filepath; $themes[$key]->prefix = $engines[$engine]->name; $themes[$key]->template = TRUE; } @@ -1184,7 +1186,7 @@ function _system_theme_data() { $pathed_stylesheets = array(); foreach ($themes[$key]->info['stylesheets'] as $media => $stylesheets) { foreach ($stylesheets as $stylesheet) { - $pathed_stylesheets[$media][$stylesheet] = dirname($themes[$key]->filename) . '/' . $stylesheet; + $pathed_stylesheets[$media][$stylesheet] = dirname($themes[$key]->filepath) . '/' . $stylesheet; } } $themes[$key]->info['stylesheets'] = $pathed_stylesheets; @@ -1192,12 +1194,12 @@ function _system_theme_data() { // Give the scripts proper path information. $scripts = array(); foreach ($themes[$key]->info['scripts'] as $script) { - $scripts[$script] = dirname($themes[$key]->filename) . '/' . $script; + $scripts[$script] = dirname($themes[$key]->filepath) . '/' . $script; } $themes[$key]->info['scripts'] = $scripts; // Give the screenshot proper path information. if (!empty($themes[$key]->info['screenshot'])) { - $themes[$key]->info['screenshot'] = dirname($themes[$key]->filename) . '/' . $themes[$key]->info['screenshot']; + $themes[$key]->info['screenshot'] = dirname($themes[$key]->filepath) . '/' . $themes[$key]->info['screenshot']; } } diff --git a/modules/update/update.compare.inc b/modules/update/update.compare.inc index 34b74849e..f2c183b86 100644 --- a/modules/update/update.compare.inc +++ b/modules/update/update.compare.inc @@ -69,7 +69,7 @@ function _update_process_info_list(&$projects, $list, $project_type) { // which is left alone by tar and correctly set to the time the .info file // was unpacked. if (!isset($file->info['_info_file_ctime'])) { - $info_filename = dirname($file->filename) . '/' . $file->name . '.info'; + $info_filename = dirname($file->filepath) . '/' . $file->name . '.info'; $file->info['_info_file_ctime'] = filectime($info_filename); } diff --git a/modules/upload/upload.test b/modules/upload/upload.test index bd4bfbdc9..b95ff78f8 100644 --- a/modules/upload/upload.test +++ b/modules/upload/upload.test @@ -39,7 +39,7 @@ class UploadTestCase extends DrupalWebTestCase { // Create a node and attempt to attach files. $node = $this->drupalCreateNode(); $text_files = $this->drupalGetTestFiles('text'); - $files = array(current($text_files)->filename, next($text_files)->filename); + $files = array(current($text_files)->filepath, next($text_files)->filepath); $this->uploadFile($node, $files[0]); $this->uploadFile($node, $files[1]); @@ -108,17 +108,17 @@ class UploadTestCase extends DrupalWebTestCase { $text_file = current($this->drupalGetTestFiles('text')); // Select a file that's less than the 1MB upload limit so we only test one // limit at a time. - $this->uploadFile($node, $text_file->filename, FALSE); + $this->uploadFile($node, $text_file->filepath, FALSE); // Test the error message in two steps in case there are additional errors // that change the error message's format. - $this->assertRaw(t('The specified file %name could not be uploaded.', array('%name' => $text_file->basename)), t('File %filename was not allowed to be uploaded', array('%filename' => $text_file->filename))); + $this->assertRaw(t('The specified file %name could not be uploaded.', array('%name' => $text_file->filename)), t('File %filepath was not allowed to be uploaded', array('%filepath' => $text_file->filepath))); $this->assertRaw(t('Only files with the following extensions are allowed: %files-allowed.', array('%files-allowed' => $settings['upload_extensions'])), t('File extension cited as reason for failure')); // Attempt to upload .html file when .html is only extension allowed. $html_files = array_values($this->drupalGetTestFiles('html')); // Use the HTML file with the .html extension, $html_files[0] has a .txt // extension. - $html_file = $html_files[1]->filename; + $html_file = $html_files[1]->filepath; $this->uploadFile($node, $html_file); $this->assertNoRaw(t('The specified file %name could not be uploaded.', array('%name' => basename($html_file))), t('File '. $html_file . ' was allowed to be uploaded')); } @@ -128,7 +128,7 @@ class UploadTestCase extends DrupalWebTestCase { */ function testLimit() { $files = $this->drupalGetTestFiles('text', 1310720); // 1 MB. - $file = current($files)->filename; + $file = current($files)->filepath; $admin_user = $this->drupalCreateUser(array('administer site configuration')); $web_user = $this->drupalCreateUser(array('access content', 'edit any page content', 'upload files', 'view uploaded files')); diff --git a/modules/user/user.test b/modules/user/user.test index 89c534a26..228be6b81 100644 --- a/modules/user/user.test +++ b/modules/user/user.test @@ -535,7 +535,7 @@ class UserPictureTestCase extends DrupalWebTestCase { $this->drupalLogin($this->user); $image = current($this->drupalGetTestFiles('image')); - $info = image_get_info($image->filename); + $info = image_get_info($image->filepath); // Set new variables: invalid dimensions, valid filesize (0 = no limit). $test_dim = ($info['width'] - 10) . 'x' . ($info['height'] - 10); @@ -569,7 +569,7 @@ class UserPictureTestCase extends DrupalWebTestCase { $this->drupalLogin($this->user); $image = current($this->drupalGetTestFiles('image')); - $info = image_get_info($image->filename); + $info = image_get_info($image->filepath); // Set new variables: valid dimensions, invalid filesize. $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10); @@ -580,9 +580,9 @@ class UserPictureTestCase extends DrupalWebTestCase { $pic_path = $this->saveUserPicture($image); // Test that the upload failed and that the correct reason was cited. - $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->basename)); + $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename)); $this->assertRaw($text, t('Upload failed.')); - $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->filename)), '%maxsize' => format_size($test_size * 1024))); + $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->filepath)), '%maxsize' => format_size($test_size * 1024))); $this->assertRaw($text, t('File size cited as reason for failure.')); // Check if file is not uploaded. @@ -604,7 +604,7 @@ class UserPictureTestCase extends DrupalWebTestCase { $this->drupalLogin($this->user); $image = current($this->drupalGetTestFiles('image')); - $info = image_get_info($image->filename); + $info = image_get_info($image->filepath); // Set new variables: invalid dimensions, valid filesize (0 = no limit). $test_dim = ($info['width'] - 10) . 'x' . ($info['height'] - 10); @@ -614,7 +614,7 @@ class UserPictureTestCase extends DrupalWebTestCase { $pic_path = $this->saveUserPicture($image); // Test that the upload failed and that the correct reason was cited. - $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->basename)); + $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename)); $this->assertRaw($text, t('Upload failed.')); $text = t('The image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => $test_dim)); $this->assertRaw($text, t('Checking response on invalid image (dimensions).')); @@ -637,7 +637,7 @@ class UserPictureTestCase extends DrupalWebTestCase { $this->drupalLogin($this->user); $image = current($this->drupalGetTestFiles('image')); - $info = image_get_info($image->filename); + $info = image_get_info($image->filepath); // Set new variables: valid dimensions, invalid filesize. $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10); @@ -648,9 +648,9 @@ class UserPictureTestCase extends DrupalWebTestCase { $pic_path = $this->saveUserPicture($image); // Test that the upload failed and that the correct reason was cited. - $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->basename)); + $text = t('The specified file %filename could not be uploaded.', array('%filename' => $image->filename)); $this->assertRaw($text, t('Upload failed.')); - $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->filename)), '%maxsize' => format_size($test_size * 1024))); + $text = t('The file is %filesize exceeding the maximum file size of %maxsize.', array('%filesize' => format_size(filesize($image->filepath)), '%maxsize' => format_size($test_size * 1024))); $this->assertRaw($text, t('File size cited as reason for failure.')); // Check if file is not uploaded. @@ -669,7 +669,7 @@ class UserPictureTestCase extends DrupalWebTestCase { $this->drupalLogin($this->user); $image = current($this->drupalGetTestFiles('image')); - $info = image_get_info($image->filename); + $info = image_get_info($image->filepath); // Set new variables: valid dimensions, valid filesize (0 = no limit). $test_dim = ($info['width'] + 10) . 'x' . ($info['height'] + 10); @@ -688,10 +688,10 @@ class UserPictureTestCase extends DrupalWebTestCase { } function saveUserPicture($image) { - $edit = array('files[picture_upload]' => realpath($image->filename)); + $edit = array('files[picture_upload]' => realpath($image->filepath)); $this->drupalPost('user/' . $this->user->uid.'/edit', $edit, t('Save')); - $img_info = image_get_info($image->filename); + $img_info = image_get_info($image->filepath); $picture_dir = variable_get('user_picture_path', 'pictures'); $pic_path = file_directory_path() . '/' . $picture_dir . '/picture-' . $this->user->uid . '.' . $img_info['extension']; |