From d90f6d917bf6e27ef35246b7dffac1eddf31750f Mon Sep 17 00:00:00 2001 From: Lars Toomre Date: Thu, 27 Sep 2012 19:09:07 -0400 Subject: [PATCH] Remove t() from assert messages in tests of file sub-system. --- .../lib/Drupal/system/Tests/File/DirectoryTest.php | 2 +- .../lib/Drupal/system/Tests/File/FileTestBase.php | 2 +- .../lib/Drupal/system/Tests/File/MimeTypeTest.php | 6 +- .../Drupal/system/Tests/File/NameMungingTest.php | 10 ++-- .../Drupal/system/Tests/File/ScanDirectoryTest.php | 46 ++++++++++---------- .../Drupal/system/Tests/File/StreamWrapperTest.php | 30 ++++++------ .../Drupal/system/Tests/File/UnmanagedCopyTest.php | 42 +++++++++--------- .../Tests/File/UnmanagedDeleteRecursiveTest.php | 26 ++++++------ .../system/Tests/File/UnmanagedDeleteTest.php | 10 ++-- .../Drupal/system/Tests/File/UnmanagedMoveTest.php | 32 +++++++------- .../system/Tests/File/UnmanagedSaveDataTest.php | 12 +++--- .../Drupal/system/Tests/File/UrlRewritingTest.php | 18 ++++---- 12 files changed, 118 insertions(+), 118 deletions(-) diff --git a/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php b/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php index 5d57bdf..878dae4 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/DirectoryTest.php @@ -126,6 +126,6 @@ class DirectoryTest extends FileTestBase { $tmp_directory = file_directory_temp(); $this->assertEqual(empty($tmp_directory), FALSE, t('file_directory_temp() returned a non-empty value.')); $setting = variable_get('file_temporary_path', ''); - $this->assertEqual($setting, $tmp_directory, t("The 'file_temporary_path' variable has the same value that file_directory_temp() returned.")); + $this->assertEqual($setting, $tmp_directory, "The 'file_temporary_path' variable has the same value that file_directory_temp() returned."); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php b/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php index 90e62d7..b1d5c6d 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/FileTestBase.php @@ -154,7 +154,7 @@ abstract class FileTestBase extends WebTestBase { if (!isset($path)) { $path = file_default_scheme() . '://' . $this->randomName(); } - $this->assertTrue(drupal_mkdir($path) && is_dir($path), t('Directory was created successfully.')); + $this->assertTrue(drupal_mkdir($path) && is_dir($path), 'Directory was created successfully.'); return $path; } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/MimeTypeTest.php b/core/modules/system/lib/Drupal/system/Tests/File/MimeTypeTest.php index 6eb2e73..5ee981d 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/MimeTypeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/MimeTypeTest.php @@ -56,11 +56,11 @@ class MimeTypeTest extends WebTestBase { foreach ($test_case as $input => $expected) { // Test stream [URI]. $output = file_get_mimetype($prefix . $input); - $this->assertIdentical($output, $expected, t('Mimetype for %input is %output (expected: %expected).', array('%input' => $input, '%output' => $output, '%expected' => $expected))); + $this->assertIdentical($output, $expected, format_string('Mimetype for %input is %output (expected: %expected).', array('%input' => $input, '%output' => $output, '%expected' => $expected))); // Test normal path equivalent $output = file_get_mimetype($input); - $this->assertIdentical($output, $expected, t('Mimetype (using default mappings) for %input is %output (expected: %expected).', array('%input' => $input, '%output' => $output, '%expected' => $expected))); + $this->assertIdentical($output, $expected, format_string('Mimetype (using default mappings) for %input is %output (expected: %expected).', array('%input' => $input, '%output' => $output, '%expected' => $expected))); } // Now test passing in the map. @@ -93,7 +93,7 @@ class MimeTypeTest extends WebTestBase { foreach ($test_case as $input => $expected) { $output = file_get_mimetype($input, $mapping); - $this->assertIdentical($output, $expected, t('Mimetype (using passed-in mappings) for %input is %output (expected: %expected).', array('%input' => $input, '%output' => $output, '%expected' => $expected))); + $this->assertIdentical($output, $expected, format_string('Mimetype (using passed-in mappings) for %input is %output (expected: %expected).', array('%input' => $input, '%output' => $output, '%expected' => $expected))); } } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/NameMungingTest.php b/core/modules/system/lib/Drupal/system/Tests/File/NameMungingTest.php index 926a34a..b37123c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/NameMungingTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/NameMungingTest.php @@ -33,8 +33,8 @@ class NameMungingTest extends FileTestBase { variable_set('allow_insecure_uploads', 0); $munged_name = file_munge_filename($this->name, '', TRUE); $messages = drupal_get_messages(); - $this->assertTrue(in_array(t('For security reasons, your upload has been renamed to %filename.', array('%filename' => $munged_name)), $messages['status']), t('Alert properly set when a file is renamed.')); - $this->assertNotEqual($munged_name, $this->name, t('The new filename (%munged) has been modified from the original (%original)', array('%munged' => $munged_name, '%original' => $this->name))); + $this->assertTrue(in_array(t('For security reasons, your upload has been renamed to %filename.', array('%filename' => $munged_name)), $messages['status']), 'Alert properly set when a file is renamed.'); + $this->assertNotEqual($munged_name, $this->name, format_string('The new filename (%munged) has been modified from the original (%original)', array('%munged' => $munged_name, '%original' => $this->name))); } /** @@ -44,7 +44,7 @@ class NameMungingTest extends FileTestBase { function testMungeIgnoreInsecure() { variable_set('allow_insecure_uploads', 1); $munged_name = file_munge_filename($this->name, ''); - $this->assertIdentical($munged_name, $this->name, t('The original filename (%original) matches the munged filename (%munged) when insecure uploads are enabled.', array('%munged' => $munged_name, '%original' => $this->name))); + $this->assertIdentical($munged_name, $this->name, format_string('The original filename (%original) matches the munged filename (%munged) when insecure uploads are enabled.', array('%munged' => $munged_name, '%original' => $this->name))); } /** @@ -53,7 +53,7 @@ class NameMungingTest extends FileTestBase { function testMungeIgnoreWhitelisted() { // Declare our extension as whitelisted. $munged_name = file_munge_filename($this->name, $this->bad_extension); - $this->assertIdentical($munged_name, $this->name, t('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', array('%munged' => $munged_name, '%original' => $this->name))); + $this->assertIdentical($munged_name, $this->name, format_string('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', array('%munged' => $munged_name, '%original' => $this->name))); } /** @@ -62,6 +62,6 @@ class NameMungingTest extends FileTestBase { function testUnMunge() { $munged_name = file_munge_filename($this->name, '', FALSE); $unmunged_name = file_unmunge_filename($munged_name); - $this->assertIdentical($unmunged_name, $this->name, t('The unmunged (%unmunged) filename matches the original (%original)', array('%unmunged' => $unmunged_name, '%original' => $this->name))); + $this->assertIdentical($unmunged_name, $this->name, format_string('The unmunged (%unmunged) filename matches the original (%original)', array('%unmunged' => $unmunged_name, '%original' => $this->name))); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/ScanDirectoryTest.php b/core/modules/system/lib/Drupal/system/Tests/File/ScanDirectoryTest.php index 4954d8e..b4a4885 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/ScanDirectoryTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/ScanDirectoryTest.php @@ -40,21 +40,21 @@ class ScanDirectoryTest extends FileTestBase { // passed to the callback. $all_files = file_scan_directory($this->path, '/^javascript-/'); ksort($all_files); - $this->assertEqual(2, count($all_files), t('Found two, expected javascript files.')); + $this->assertEqual(2, count($all_files), 'Found two, expected javascript files.'); // Check the first file. $file = reset($all_files); - $this->assertEqual(key($all_files), $file->uri, t('Correct array key was used for the first returned file.')); - $this->assertEqual($file->uri, $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.')); + $this->assertEqual(key($all_files), $file->uri, 'Correct array key was used for the first returned file.'); + $this->assertEqual($file->uri, $this->path . '/javascript-1.txt', 'First file name was set correctly.'); + $this->assertEqual($file->filename, 'javascript-1.txt', 'First basename was set correctly'); + $this->assertEqual($file->name, 'javascript-1', 'First name was set correctly.'); // Check the second file. $file = next($all_files); - $this->assertEqual(key($all_files), $file->uri, t('Correct array key was used for the second returned file.')); - $this->assertEqual($file->uri, $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.')); + $this->assertEqual(key($all_files), $file->uri, 'Correct array key was used for the second returned file.'); + $this->assertEqual($file->uri, $this->path . '/javascript-2.script', 'Second file name was set correctly.'); + $this->assertEqual($file->filename, 'javascript-2.script', 'Second basename was set correctly'); + $this->assertEqual($file->name, 'javascript-2', 'Second name was set correctly.'); } /** @@ -65,18 +65,18 @@ class ScanDirectoryTest extends FileTestBase { // When nothing is matched nothing should be passed to the callback. $all_files = file_scan_directory($this->path, '/^NONEXISTINGFILENAME/', array('callback' => 'file_test_file_scan_callback')); - $this->assertEqual(0, count($all_files), t('No files were found.')); + $this->assertEqual(0, count($all_files), 'No files were found.'); $results = file_test_file_scan_callback(); file_test_file_scan_callback_reset(); - $this->assertEqual(0, count($results), t('No files were passed to the callback.')); + $this->assertEqual(0, count($results), 'No files were passed to the callback.'); // Grab a listing of all the JavaSscript files and check that they're // passed to the callback. $all_files = file_scan_directory($this->path, '/^javascript-/', array('callback' => 'file_test_file_scan_callback')); - $this->assertEqual(2, count($all_files), t('Found two, expected javascript files.')); + $this->assertEqual(2, count($all_files), 'Found two, expected javascript files.'); $results = file_test_file_scan_callback(); file_test_file_scan_callback_reset(); - $this->assertEqual(2, count($results), t('Files were passed to the callback.')); + $this->assertEqual(2, count($results), 'Files were passed to the callback.'); } /** @@ -85,11 +85,11 @@ class ScanDirectoryTest extends FileTestBase { function testOptionNoMask() { // Grab a listing of all the JavaSscript files. $all_files = file_scan_directory($this->path, '/^javascript-/'); - $this->assertEqual(2, count($all_files), t('Found two, expected javascript files.')); + $this->assertEqual(2, count($all_files), 'Found two, expected javascript files.'); // Now use the nomast parameter to filter out the .script file. $filtered_files = file_scan_directory($this->path, '/^javascript-/', array('nomask' => '/.script$/')); - $this->assertEqual(1, count($filtered_files), t('Filtered correctly.')); + $this->assertEqual(1, count($filtered_files), 'Filtered correctly.'); } /** @@ -100,25 +100,25 @@ class ScanDirectoryTest extends FileTestBase { $expected = array($this->path . '/javascript-1.txt', $this->path . '/javascript-2.script'); $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.')); + $this->assertEqual($expected, $actual, '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' => 'filename'))); sort($actual); - $this->assertEqual($expected, $actual, t('Returned the correct values for the basename key.')); + $this->assertEqual($expected, $actual, 'Returned the correct values for the basename key.'); // "name" for the name of the file without an extension. $expected = array('javascript-1', 'javascript-2'); $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'name'))); sort($actual); - $this->assertEqual($expected, $actual, t('Returned the correct values for the name key.')); + $this->assertEqual($expected, $actual, 'Returned the correct values for the name key.'); // Invalid option that should default back to "filename". $expected = array($this->path . '/javascript-1.txt', $this->path . '/javascript-2.script'); $actual = array_keys(file_scan_directory($this->path, '/^javascript-/', array('key' => 'INVALID'))); sort($actual); - $this->assertEqual($expected, $actual, t('An invalid key defaulted back to the default.')); + $this->assertEqual($expected, $actual, 'An invalid key defaulted back to the default.'); } /** @@ -126,10 +126,10 @@ class ScanDirectoryTest extends FileTestBase { */ function testOptionRecurse() { $files = file_scan_directory(drupal_get_path('module', 'simpletest'), '/^javascript-/', array('recurse' => FALSE)); - $this->assertTrue(empty($files), t("Without recursion couldn't find javascript files.")); + $this->assertTrue(empty($files), "Without recursion couldn't find javascript files."); $files = file_scan_directory(drupal_get_path('module', 'simpletest'), '/^javascript-/', array('recurse' => TRUE)); - $this->assertEqual(2, count($files), t('With recursion we found the expected javascript files.')); + $this->assertEqual(2, count($files), 'With recursion we found the expected javascript files.'); } @@ -139,9 +139,9 @@ class ScanDirectoryTest extends FileTestBase { */ function testOptionMinDepth() { $files = file_scan_directory($this->path, '/^javascript-/', array('min_depth' => 0)); - $this->assertEqual(2, count($files), t('No minimum-depth gets files in current directory.')); + $this->assertEqual(2, count($files), 'No minimum-depth gets files in current directory.'); $files = file_scan_directory($this->path, '/^javascript-/', array('min_depth' => 1)); - $this->assertTrue(empty($files), t("Minimum-depth of 1 successfully excludes files from current directory.")); + $this->assertTrue(empty($files), 'Minimum-depth of 1 successfully excludes files from current directory.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/StreamWrapperTest.php b/core/modules/system/lib/Drupal/system/Tests/File/StreamWrapperTest.php index 0cbe2c0..f94d7b1 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/StreamWrapperTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/StreamWrapperTest.php @@ -47,9 +47,9 @@ class StreamWrapperTest extends WebTestBase { */ function testGetClassName() { // Check the dummy scheme. - $this->assertEqual($this->classname, file_stream_wrapper_get_class($this->scheme), t('Got correct class name for dummy scheme.')); + $this->assertEqual($this->classname, file_stream_wrapper_get_class($this->scheme), 'Got correct class name for dummy scheme.'); // Check core's scheme. - $this->assertEqual('Drupal\Core\StreamWrapper\PublicStream', file_stream_wrapper_get_class('public'), t('Got correct class name for public scheme.')); + $this->assertEqual('Drupal\Core\StreamWrapper\PublicStream', file_stream_wrapper_get_class('public'), 'Got correct class name for public scheme.'); } /** @@ -57,10 +57,10 @@ class StreamWrapperTest extends WebTestBase { */ function testGetInstanceByScheme() { $instance = file_stream_wrapper_get_instance_by_scheme($this->scheme); - $this->assertEqual($this->classname, get_class($instance), t('Got correct class type for dummy scheme.')); + $this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy scheme.'); $instance = file_stream_wrapper_get_instance_by_scheme('public'); - $this->assertEqual('Drupal\Core\StreamWrapper\PublicStream', get_class($instance), t('Got correct class type for public scheme.')); + $this->assertEqual('Drupal\Core\StreamWrapper\PublicStream', get_class($instance), 'Got correct class type for public scheme.'); } /** @@ -68,31 +68,31 @@ class StreamWrapperTest extends WebTestBase { */ function testUriFunctions() { $instance = file_stream_wrapper_get_instance_by_uri($this->scheme . '://foo'); - $this->assertEqual($this->classname, get_class($instance), t('Got correct class type for dummy URI.')); + $this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy URI.'); $instance = file_stream_wrapper_get_instance_by_uri('public://foo'); - $this->assertEqual('Drupal\Core\StreamWrapper\PublicStream', get_class($instance), t('Got correct class type for public URI.')); + $this->assertEqual('Drupal\Core\StreamWrapper\PublicStream', get_class($instance), 'Got correct class type for public URI.'); // Test file_uri_target(). - $this->assertEqual(file_uri_target('public://foo/bar.txt'), 'foo/bar.txt', t('Got a valid stream target from public://foo/bar.txt.')); - $this->assertFalse(file_uri_target('foo/bar.txt'), t('foo/bar.txt is not a valid stream.')); + $this->assertEqual(file_uri_target('public://foo/bar.txt'), 'foo/bar.txt', 'Got a valid stream target from public://foo/bar.txt.'); + $this->assertFalse(file_uri_target('foo/bar.txt'), 'foo/bar.txt is not a valid stream.'); // Test file_build_uri() and // Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath(). - $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', t('Expected scheme was added.')); - $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath(), variable_get('file_public_path'), t('Expected default directory path was returned.')); - $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('temporary')->getDirectoryPath(), variable_get('file_temporary_path'), t('Expected temporary directory path was returned.')); + $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', 'Expected scheme was added.'); + $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath(), variable_get('file_public_path'), 'Expected default directory path was returned.'); + $this->assertEqual(file_stream_wrapper_get_instance_by_scheme('temporary')->getDirectoryPath(), variable_get('file_temporary_path'), 'Expected temporary directory path was returned.'); variable_set('file_default_scheme', 'private'); - $this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', t('Got a valid URI from foo/bar.txt.')); + $this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', 'Got a valid URI from foo/bar.txt.'); } /** * Test the scheme functions. */ function testGetValidStreamScheme() { - $this->assertEqual('foo', file_uri_scheme('foo://pork//chops'), t('Got the correct scheme from foo://asdf')); - $this->assertTrue(file_stream_wrapper_valid_scheme(file_uri_scheme('public://asdf')), t('Got a valid stream scheme from public://asdf')); - $this->assertFalse(file_stream_wrapper_valid_scheme(file_uri_scheme('foo://asdf')), t('Did not get a valid stream scheme from foo://asdf')); + $this->assertEqual('foo', file_uri_scheme('foo://pork//chops'), 'Got the correct scheme from foo://asdf'); + $this->assertTrue(file_stream_wrapper_valid_scheme(file_uri_scheme('public://asdf')), 'Got a valid stream scheme from public://asdf'); + $this->assertFalse(file_stream_wrapper_valid_scheme(file_uri_scheme('foo://asdf')), 'Did not get a valid stream scheme from foo://asdf'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php index c4a44f9..ca01900 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedCopyTest.php @@ -29,20 +29,20 @@ class UnmanagedCopyTest extends FileTestBase { // Copying to a new name. $desired_filepath = 'public://' . $this->randomName(); $new_filepath = file_unmanaged_copy($uri, $desired_filepath, FILE_EXISTS_ERROR); - $this->assertTrue($new_filepath, t('Copy was successful.')); - $this->assertEqual($new_filepath, $desired_filepath, t('Returned expected filepath.')); - $this->assertTrue(file_exists($uri), t('Original file remains.')); - $this->assertTrue(file_exists($new_filepath), t('New file exists.')); + $this->assertTrue($new_filepath, 'Copy was successful.'); + $this->assertEqual($new_filepath, $desired_filepath, 'Returned expected filepath.'); + $this->assertTrue(file_exists($uri), 'Original file remains.'); + $this->assertTrue(file_exists($new_filepath), 'New file exists.'); $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664)); // Copying with rename. $desired_filepath = 'public://' . $this->randomName(); - $this->assertTrue(file_put_contents($desired_filepath, ' '), t('Created a file so a rename will have to happen.')); + $this->assertTrue(file_put_contents($desired_filepath, ' '), 'Created a file so a rename will have to happen.'); $newer_filepath = file_unmanaged_copy($uri, $desired_filepath, FILE_EXISTS_RENAME); $this->assertTrue($newer_filepath, t('Copy was successful.')); - $this->assertNotEqual($newer_filepath, $desired_filepath, t('Returned expected filepath.')); - $this->assertTrue(file_exists($uri), t('Original file remains.')); - $this->assertTrue(file_exists($newer_filepath), t('New file exists.')); + $this->assertNotEqual($newer_filepath, $desired_filepath, 'Returned expected filepath.'); + $this->assertTrue(file_exists($uri), 'Original file remains.'); + $this->assertTrue(file_exists($newer_filepath), 'New file exists.'); $this->assertFilePermissions($newer_filepath, variable_get('file_chmod_file', 0664)); // TODO: test copying to a directory (rather than full directory/file path) @@ -55,9 +55,9 @@ class UnmanagedCopyTest extends FileTestBase { function testNonExistent() { // Copy non-existent file $desired_filepath = $this->randomName(); - $this->assertFalse(file_exists($desired_filepath), t("Randomly named file doesn't exists.")); + $this->assertFalse(file_exists($desired_filepath), "Randomly named file doesn't exists."); $new_filepath = file_unmanaged_copy($desired_filepath, $this->randomName()); - $this->assertFalse($new_filepath, t('Copying a missing file fails.')); + $this->assertFalse($new_filepath, 'Copying a missing file fails.'); } /** @@ -69,28 +69,28 @@ class UnmanagedCopyTest extends FileTestBase { // Copy the file onto itself with renaming works. $new_filepath = file_unmanaged_copy($uri, $uri, FILE_EXISTS_RENAME); - $this->assertTrue($new_filepath, t('Copying onto itself with renaming works.')); - $this->assertNotEqual($new_filepath, $uri, t('Copied file has a new name.')); - $this->assertTrue(file_exists($uri), t('Original file exists after copying onto itself.')); - $this->assertTrue(file_exists($new_filepath), t('Copied file exists after copying onto itself.')); + $this->assertTrue($new_filepath, 'Copying onto itself with renaming works.'); + $this->assertNotEqual($new_filepath, $uri, 'Copied file has a new name.'); + $this->assertTrue(file_exists($uri), 'Original file exists after copying onto itself.'); + $this->assertTrue(file_exists($new_filepath), 'Copied file exists after copying onto itself.'); $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664)); // Copy the file onto itself without renaming fails. $new_filepath = file_unmanaged_copy($uri, $uri, FILE_EXISTS_ERROR); - $this->assertFalse($new_filepath, t('Copying onto itself without renaming fails.')); - $this->assertTrue(file_exists($uri), t('File exists after copying onto itself.')); + $this->assertFalse($new_filepath, 'Copying onto itself without renaming fails.'); + $this->assertTrue(file_exists($uri), 'File exists after copying onto itself.'); // Copy the file into same directory without renaming fails. $new_filepath = file_unmanaged_copy($uri, drupal_dirname($uri), FILE_EXISTS_ERROR); - $this->assertFalse($new_filepath, t('Copying onto itself fails.')); + $this->assertFalse($new_filepath, 'Copying onto itself fails.'); $this->assertTrue(file_exists($uri), t('File exists after copying onto itself.')); // Copy the file into same directory with renaming works. $new_filepath = file_unmanaged_copy($uri, drupal_dirname($uri), FILE_EXISTS_RENAME); - $this->assertTrue($new_filepath, t('Copying into same directory works.')); - $this->assertNotEqual($new_filepath, $uri, t('Copied file has a new name.')); - $this->assertTrue(file_exists($uri), t('Original file exists after copying onto itself.')); - $this->assertTrue(file_exists($new_filepath), t('Copied file exists after copying onto itself.')); + $this->assertTrue($new_filepath, 'Copying into same directory works.'); + $this->assertNotEqual($new_filepath, $uri, 'Copied file has a new name.'); + $this->assertTrue(file_exists($uri), 'Original file exists after copying onto itself.'); + $this->assertTrue(file_exists($new_filepath), 'Copied file exists after copying onto itself.'); $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664)); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php index 77fecb2..2a93ac6 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteRecursiveTest.php @@ -28,8 +28,8 @@ class UnmanagedDeleteRecursiveTest extends FileTestBase { file_put_contents($filepath, ''); // Delete the file. - $this->assertTrue(file_unmanaged_delete_recursive($filepath), t('Function reported success.')); - $this->assertFalse(file_exists($filepath), t('Test file has been deleted.')); + $this->assertTrue(file_unmanaged_delete_recursive($filepath), 'Function reported success.'); + $this->assertFalse(file_exists($filepath), 'Test file has been deleted.'); } /** @@ -40,8 +40,8 @@ class UnmanagedDeleteRecursiveTest extends FileTestBase { $directory = $this->createDirectory(); // Delete the directory. - $this->assertTrue(file_unmanaged_delete_recursive($directory), t('Function reported success.')); - $this->assertFalse(file_exists($directory), t('Directory has been deleted.')); + $this->assertTrue(file_unmanaged_delete_recursive($directory), 'Function reported success.'); + $this->assertFalse(file_exists($directory), 'Directory has been deleted.'); } /** @@ -56,10 +56,10 @@ class UnmanagedDeleteRecursiveTest extends FileTestBase { file_put_contents($filepathB, ''); // Delete the directory. - $this->assertTrue(file_unmanaged_delete_recursive($directory), t('Function reported success.')); - $this->assertFalse(file_exists($filepathA), t('Test file A has been deleted.')); - $this->assertFalse(file_exists($filepathB), t('Test file B has been deleted.')); - $this->assertFalse(file_exists($directory), t('Directory has been deleted.')); + $this->assertTrue(file_unmanaged_delete_recursive($directory), 'Function reported success.'); + $this->assertFalse(file_exists($filepathA), 'Test file A has been deleted.'); + $this->assertFalse(file_exists($filepathB), 'Test file B has been deleted.'); + $this->assertFalse(file_exists($directory), 'Directory has been deleted.'); } /** @@ -75,10 +75,10 @@ class UnmanagedDeleteRecursiveTest extends FileTestBase { file_put_contents($filepathB, ''); // Delete the directory. - $this->assertTrue(file_unmanaged_delete_recursive($directory), t('Function reported success.')); - $this->assertFalse(file_exists($filepathA), t('Test file A has been deleted.')); - $this->assertFalse(file_exists($filepathB), t('Test file B has been deleted.')); - $this->assertFalse(file_exists($subdirectory), t('Subdirectory has been deleted.')); - $this->assertFalse(file_exists($directory), t('Directory has been deleted.')); + $this->assertTrue(file_unmanaged_delete_recursive($directory), 'Function reported success.'); + $this->assertFalse(file_exists($filepathA), 'Test file A has been deleted.'); + $this->assertFalse(file_exists($filepathB), 'Test file B has been deleted.'); + $this->assertFalse(file_exists($subdirectory), 'Subdirectory has been deleted.'); + $this->assertFalse(file_exists($directory), 'Directory has been deleted.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php index 8ecd1ae..005cba0 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedDeleteTest.php @@ -27,8 +27,8 @@ class UnmanagedDeleteTest extends FileTestBase { $uri = $this->createUri(); // Delete a regular file - $this->assertTrue(file_unmanaged_delete($uri), t('Deleted worked.')); - $this->assertFalse(file_exists($uri), t('Test file has actually been deleted.')); + $this->assertTrue(file_unmanaged_delete($uri), 'Deleted worked.'); + $this->assertFalse(file_exists($uri), 'Test file has actually been deleted.'); } /** @@ -36,7 +36,7 @@ class UnmanagedDeleteTest extends FileTestBase { */ function testMissing() { // Try to delete a non-existing file - $this->assertTrue(file_unmanaged_delete(file_default_scheme() . '/' . $this->randomName()), t('Returns true when deleting a non-existent file.')); + $this->assertTrue(file_unmanaged_delete(file_default_scheme() . '/' . $this->randomName()), 'Returns true when deleting a non-existent file.'); } /** @@ -47,7 +47,7 @@ class UnmanagedDeleteTest extends FileTestBase { $directory = $this->createDirectory(); // Try to delete a directory - $this->assertFalse(file_unmanaged_delete($directory), t('Could not delete the delete directory.')); - $this->assertTrue(file_exists($directory), t('Directory has not been deleted.')); + $this->assertFalse(file_unmanaged_delete($directory), 'Could not delete the delete directory.'); + $this->assertTrue(file_exists($directory), 'Directory has not been deleted.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php index 1090aaa..6e0ec14 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedMoveTest.php @@ -29,21 +29,21 @@ class UnmanagedMoveTest extends FileTestBase { // Moving to a new name. $desired_filepath = 'public://' . $this->randomName(); $new_filepath = file_unmanaged_move($uri, $desired_filepath, FILE_EXISTS_ERROR); - $this->assertTrue($new_filepath, t('Move was successful.')); - $this->assertEqual($new_filepath, $desired_filepath, t('Returned expected filepath.')); - $this->assertTrue(file_exists($new_filepath), t('File exists at the new location.')); - $this->assertFalse(file_exists($uri), t('No file remains at the old location.')); + $this->assertTrue($new_filepath, 'Move was successful.'); + $this->assertEqual($new_filepath, $desired_filepath, 'Returned expected filepath.'); + $this->assertTrue(file_exists($new_filepath), 'File exists at the new location.'); + $this->assertFalse(file_exists($uri), 'No file remains at the old location.'); $this->assertFilePermissions($new_filepath, variable_get('file_chmod_file', 0664)); // Moving with rename. $desired_filepath = 'public://' . $this->randomName(); - $this->assertTrue(file_exists($new_filepath), t('File exists before moving.')); - $this->assertTrue(file_put_contents($desired_filepath, ' '), t('Created a file so a rename will have to happen.')); + $this->assertTrue(file_exists($new_filepath), 'File exists before moving.'); + $this->assertTrue(file_put_contents($desired_filepath, ' '), 'Created a file so a rename will have to happen.'); $newer_filepath = file_unmanaged_move($new_filepath, $desired_filepath, FILE_EXISTS_RENAME); - $this->assertTrue($newer_filepath, t('Move was successful.')); - $this->assertNotEqual($newer_filepath, $desired_filepath, t('Returned expected filepath.')); - $this->assertTrue(file_exists($newer_filepath), t('File exists at the new location.')); - $this->assertFalse(file_exists($new_filepath), t('No file remains at the old location.')); + $this->assertTrue($newer_filepath, 'Move was successful.'); + $this->assertNotEqual($newer_filepath, $desired_filepath, 'Returned expected filepath.'); + $this->assertTrue(file_exists($newer_filepath), 'File exists at the new location.'); + $this->assertFalse(file_exists($new_filepath), 'No file remains at the old location.'); $this->assertFilePermissions($newer_filepath, variable_get('file_chmod_file', 0664)); // TODO: test moving to a directory (rather than full directory/file path) @@ -56,7 +56,7 @@ class UnmanagedMoveTest extends FileTestBase { function testMissing() { // Move non-existent file. $new_filepath = file_unmanaged_move($this->randomName(), $this->randomName()); - $this->assertFalse($new_filepath, t('Moving a missing file fails.')); + $this->assertFalse($new_filepath, 'Moving a missing file fails.'); } /** @@ -68,13 +68,13 @@ class UnmanagedMoveTest extends FileTestBase { // Move the file onto itself without renaming shouldn't make changes. $new_filepath = file_unmanaged_move($uri, $uri, FILE_EXISTS_REPLACE); - $this->assertFalse($new_filepath, t('Moving onto itself without renaming fails.')); - $this->assertTrue(file_exists($uri), t('File exists after moving onto itself.')); + $this->assertFalse($new_filepath, 'Moving onto itself without renaming fails.'); + $this->assertTrue(file_exists($uri), 'File exists after moving onto itself.'); // Move the file onto itself with renaming will result in a new filename. $new_filepath = file_unmanaged_move($uri, $uri, FILE_EXISTS_RENAME); - $this->assertTrue($new_filepath, t('Moving onto itself with renaming works.')); - $this->assertFalse(file_exists($uri), t('Original file has been removed.')); - $this->assertTrue(file_exists($new_filepath), t('File exists after moving onto itself.')); + $this->assertTrue($new_filepath, 'Moving onto itself with renaming works.'); + $this->assertFalse(file_exists($uri), 'Original file has been removed.'); + $this->assertTrue(file_exists($new_filepath), 'File exists after moving onto itself.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php index 6494b86..cde75c7 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UnmanagedSaveDataTest.php @@ -27,15 +27,15 @@ class UnmanagedSaveDataTest extends FileTestBase { // No filename. $filepath = file_unmanaged_save_data($contents); - $this->assertTrue($filepath, t('Unnamed file saved correctly.')); - $this->assertEqual(file_uri_scheme($filepath), file_default_scheme(), t("File was placed in Drupal's files directory.")); - $this->assertEqual($contents, file_get_contents($filepath), t('Contents of the file are correct.')); + $this->assertTrue($filepath, 'Unnamed file saved correctly.'); + $this->assertEqual(file_uri_scheme($filepath), file_default_scheme(), "File was placed in Drupal's files directory."); + $this->assertEqual($contents, file_get_contents($filepath), 'Contents of the file are correct.'); // Provide a filename. $filepath = file_unmanaged_save_data($contents, 'public://asdf.txt', FILE_EXISTS_REPLACE); - $this->assertTrue($filepath, t('Unnamed file saved correctly.')); - $this->assertEqual('asdf.txt', drupal_basename($filepath), t('File was named correctly.')); - $this->assertEqual($contents, file_get_contents($filepath), t('Contents of the file are correct.')); + $this->assertTrue($filepath, 'Unnamed file saved correctly.'); + $this->assertEqual('asdf.txt', drupal_basename($filepath), 'File was named correctly.'); + $this->assertEqual($contents, file_get_contents($filepath), 'Contents of the file are correct.'); $this->assertFilePermissions($filepath, variable_get('file_chmod_file', 0664)); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/File/UrlRewritingTest.php b/core/modules/system/lib/Drupal/system/Tests/File/UrlRewritingTest.php index 5422f90..bce5684 100644 --- a/core/modules/system/lib/Drupal/system/Tests/File/UrlRewritingTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/File/UrlRewritingTest.php @@ -38,28 +38,28 @@ class UrlRewritingTest extends FileTestBase { variable_set('file_test_hook_file_url_alter', 'cdn'); $filepath = 'core/misc/jquery.js'; $url = file_create_url($filepath); - $this->assertEqual(FILE_URL_TEST_CDN_1 . '/' . $filepath, $url, t('Correctly generated a CDN URL for a shipped file.')); + $this->assertEqual(FILE_URL_TEST_CDN_1 . '/' . $filepath, $url, 'Correctly generated a CDN URL for a shipped file.'); $filepath = 'core/misc/favicon.ico'; $url = file_create_url($filepath); - $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . $filepath, $url, t('Correctly generated a CDN URL for a shipped file.')); + $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . $filepath, $url, 'Correctly generated a CDN URL for a shipped file.'); // Test alteration of file URLs to use root-relative URLs. variable_set('file_test_hook_file_url_alter', 'root-relative'); $filepath = 'core/misc/jquery.js'; $url = file_create_url($filepath); - $this->assertEqual(base_path() . '/' . $filepath, $url, t('Correctly generated a root-relative URL for a shipped file.')); + $this->assertEqual(base_path() . '/' . $filepath, $url, 'Correctly generated a root-relative URL for a shipped file.'); $filepath = 'core/misc/favicon.ico'; $url = file_create_url($filepath); - $this->assertEqual(base_path() . '/' . $filepath, $url, t('Correctly generated a root-relative URL for a shipped file.')); + $this->assertEqual(base_path() . '/' . $filepath, $url, 'Correctly generated a root-relative URL for a shipped file.'); // Test alteration of file URLs to use protocol-relative URLs. variable_set('file_test_hook_file_url_alter', 'protocol-relative'); $filepath = 'core/misc/jquery.js'; $url = file_create_url($filepath); - $this->assertEqual('/' . base_path() . '/' . $filepath, $url, t('Correctly generated a protocol-relative URL for a shipped file.')); + $this->assertEqual('/' . base_path() . '/' . $filepath, $url, 'Correctly generated a protocol-relative URL for a shipped file.'); $filepath = 'core/misc/favicon.ico'; $url = file_create_url($filepath); - $this->assertEqual('/' . base_path() . '/' . $filepath, $url, t('Correctly generated a protocol-relative URL for a shipped file.')); + $this->assertEqual('/' . base_path() . '/' . $filepath, $url, 'Correctly generated a protocol-relative URL for a shipped file.'); } /** @@ -73,18 +73,18 @@ class UrlRewritingTest extends FileTestBase { $uri = $this->createUri(); $url = file_create_url($uri); $public_directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath(); - $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . $public_directory_path . '/' . drupal_basename($uri), $url, t('Correctly generated a CDN URL for a created file.')); + $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . $public_directory_path . '/' . drupal_basename($uri), $url, 'Correctly generated a CDN URL for a created file.'); // Test alteration of file URLs to use root-relative URLs. variable_set('file_test_hook_file_url_alter', 'root-relative'); $uri = $this->createUri(); $url = file_create_url($uri); - $this->assertEqual(base_path() . '/' . $public_directory_path . '/' . drupal_basename($uri), $url, t('Correctly generated a root-relative URL for a created file.')); + $this->assertEqual(base_path() . '/' . $public_directory_path . '/' . drupal_basename($uri), $url, 'Correctly generated a root-relative URL for a created file.'); // Test alteration of file URLs to use a protocol-relative URLs. variable_set('file_test_hook_file_url_alter', 'protocol-relative'); $uri = $this->createUri(); $url = file_create_url($uri); - $this->assertEqual('/' . base_path() . '/' . $public_directory_path . '/' . drupal_basename($uri), $url, t('Correctly generated a protocol-relative URL for a created file.')); + $this->assertEqual('/' . base_path() . '/' . $public_directory_path . '/' . drupal_basename($uri), $url, 'Correctly generated a protocol-relative URL for a created file.'); } } -- 1.7.6.msysgit.0