summaryrefslogtreecommitdiff
path: root/modules/file/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/file/tests')
-rw-r--r--modules/file/tests/file.test21
-rw-r--r--modules/file/tests/file_module_test.info1
-rw-r--r--modules/file/tests/file_module_test.module1
3 files changed, 11 insertions, 12 deletions
diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test
index bf74b8b71..ea8c5c67b 100644
--- a/modules/file/tests/file.test
+++ b/modules/file/tests/file.test
@@ -1,9 +1,8 @@
<?php
-// $Id$
/**
* @file
- * Tests file uploading through the File module.
+ * Tests for file.module.
*/
/**
@@ -254,7 +253,7 @@ class FileManagedFileElementTestCase extends FileFieldTestCase {
$this->drupalPost($path . '/' . $last_fid, array(), t('Save'));
$this->assertRaw(t('The file id is %fid.', array('%fid' => $last_fid)), t('Empty submission did not change an existing file.'));
- // Now, test the Upload and Remove buttons, with and without AJAX.
+ // Now, test the Upload and Remove buttons, with and without Ajax.
foreach (array(FALSE, TRUE) as $ajax) {
// Upload, then Submit.
$last_fid_prior = $this->getLastFileId();
@@ -302,7 +301,7 @@ class FileManagedFileElementTestCase extends FileFieldTestCase {
}
/**
- * Test class to test file field widget, single and multi-valued, with and without AJAX, with public and private files.
+ * Test class to test file field widget, single and multi-valued, with and without Ajax, with public and private files.
*/
class FileFieldWidgetTestCase extends FileFieldTestCase {
public static function getInfo() {
@@ -314,7 +313,7 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
}
/**
- * Tests upload and remove buttons, with and without AJAX, for a single-valued File field.
+ * Tests upload and remove buttons, with and without Ajax, for a single-valued File field.
*/
function testSingleValuedWidget() {
// Use 'page' instead of 'article', so that the 'article' image field does
@@ -371,7 +370,7 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
}
/**
- * Tests upload and remove buttons, with and without AJAX, for a multi-valued File field.
+ * Tests upload and remove buttons, with and without Ajax, for a multi-valued File field.
*/
function testMultiValuedWidget() {
// Use 'page' instead of 'article', so that the 'article' image field does
@@ -390,7 +389,7 @@ class FileFieldWidgetTestCase extends FileFieldTestCase {
// Visit the node creation form, and upload 3 files. Since the field has
// cardinality of 3, ensure the "Upload" button is displayed until after
// the 3rd file, and after that, isn't displayed.
- // @todo This is only testing a non-AJAX upload, because drupalPostAJAX()
+ // @todo This is only testing a non-Ajax upload, because drupalPostAJAX()
// does not yet emulate jQuery's file upload.
$this->drupalGet("node/add/$type_name");
for ($delta = 0; $delta < 3; $delta++) {
@@ -933,7 +932,7 @@ class FileFieldPathTestCase extends FileFieldTestCase {
// Check the path when used with tokens.
// Change the path to contain multiple token directories.
- $field = $this->updateFileField($field_name, $type_name, array('file_directory' => '[user:uid]/[user:name]'));
+ $field = $this->updateFileField($field_name, $type_name, array('file_directory' => '[current-user:uid]/[current-user:name]'));
// Upload a new file into the token subdirectories.
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
@@ -941,6 +940,8 @@ class FileFieldPathTestCase extends FileFieldTestCase {
// Check that the file was uploaded into the subdirectory.
$node = node_load($nid, NULL, TRUE);
$node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
+ // Do token replacement using the same user which uploaded the file, not
+ // the user running the test case.
$data = array('user' => $this->admin_user);
$subdirectory = token_replace('[user:uid]/[user:name]', $data);
$this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path with token replacements.', array('%file' => $node_file->uri)));
@@ -1027,7 +1028,7 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('file' => $file), array('language' => $language));
- $this->assertFalse(strcmp($output, $expected), t('Sanitized file token %token replaced.', array('%token' => $input)));
+ $this->assertEqual($output, $expected, t('Sanitized file token %token replaced.', array('%token' => $input)));
}
// Generate and test unsanitized tokens.
@@ -1039,7 +1040,7 @@ class FileTokenReplaceTestCase extends FileFieldTestCase {
foreach ($tests as $input => $expected) {
$output = token_replace($input, array('file' => $file), array('language' => $language, 'sanitize' => FALSE));
- $this->assertFalse(strcmp($output, $expected), t('Unsanitized file token %token replaced.', array('%token' => $input)));
+ $this->assertEqual($output, $expected, t('Unsanitized file token %token replaced.', array('%token' => $input)));
}
}
}
diff --git a/modules/file/tests/file_module_test.info b/modules/file/tests/file_module_test.info
index 50e2bd4b2..8db907b74 100644
--- a/modules/file/tests/file_module_test.info
+++ b/modules/file/tests/file_module_test.info
@@ -1,4 +1,3 @@
-; $Id$
name = File test
description = Provides hooks for testing File module functionality.
package = Core
diff --git a/modules/file/tests/file_module_test.module b/modules/file/tests/file_module_test.module
index 7bccb4a67..ea65981ca 100644
--- a/modules/file/tests/file_module_test.module
+++ b/modules/file/tests/file_module_test.module
@@ -1,5 +1,4 @@
<?php
-// $Id$
/**
* @file