diff options
author | Jennifer Hodgdon <yahgrp@poplarware.com> | 2013-04-26 08:53:13 -0700 |
---|---|---|
committer | Jennifer Hodgdon <yahgrp@poplarware.com> | 2013-04-26 08:53:13 -0700 |
commit | 8ee9e5ab409021fbd250c7a093691c5a10f36ae2 (patch) | |
tree | 7db56cae21674a4edfe7dd5bd5a39484803580a7 /modules/simpletest | |
parent | b61b0d72791f4e4f78acced2efd04a5dbe0f2723 (diff) | |
download | brdo-8ee9e5ab409021fbd250c7a093691c5a10f36ae2.tar.gz brdo-8ee9e5ab409021fbd250c7a093691c5a10f36ae2.tar.bz2 |
Issue #1797926 by dcam, izus, Lars Toomre: Remove t() from test asserts in misc system tests
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/tests/error.test | 22 | ||||
-rw-r--r-- | modules/simpletest/tests/password.test | 20 | ||||
-rw-r--r-- | modules/simpletest/tests/unicode.test | 14 |
3 files changed, 28 insertions, 28 deletions
diff --git a/modules/simpletest/tests/error.test b/modules/simpletest/tests/error.test index 5b6b04b9e..f946e82f1 100644 --- a/modules/simpletest/tests/error.test +++ b/modules/simpletest/tests/error.test @@ -42,7 +42,7 @@ class DrupalErrorHandlerTestCase extends DrupalWebTestCase { // Set error reporting to collect notices. variable_set('error_level', ERROR_REPORTING_DISPLAY_ALL); $this->drupalGet('error-test/generate-warnings'); - $this->assertResponse(200, t('Received expected HTTP status code.')); + $this->assertResponse(200, 'Received expected HTTP status code.'); $this->assertErrorMessage($error_notice); $this->assertErrorMessage($error_warning); $this->assertErrorMessage($error_user_notice); @@ -50,7 +50,7 @@ class DrupalErrorHandlerTestCase extends DrupalWebTestCase { // Set error reporting to not collect notices. variable_set('error_level', ERROR_REPORTING_DISPLAY_SOME); $this->drupalGet('error-test/generate-warnings'); - $this->assertResponse(200, t('Received expected HTTP status code.')); + $this->assertResponse(200, 'Received expected HTTP status code.'); $this->assertNoErrorMessage($error_notice); $this->assertErrorMessage($error_warning); $this->assertErrorMessage($error_user_notice); @@ -58,7 +58,7 @@ class DrupalErrorHandlerTestCase extends DrupalWebTestCase { // Set error reporting to not show any errors. variable_set('error_level', ERROR_REPORTING_HIDE); $this->drupalGet('error-test/generate-warnings'); - $this->assertResponse(200, t('Received expected HTTP status code.')); + $this->assertResponse(200, 'Received expected HTTP status code.'); $this->assertNoErrorMessage($error_notice); $this->assertNoErrorMessage($error_warning); $this->assertNoErrorMessage($error_user_notice); @@ -84,17 +84,17 @@ class DrupalErrorHandlerTestCase extends DrupalWebTestCase { ); $this->drupalGet('error-test/trigger-exception'); - $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), t('Received expected HTTP status line.')); + $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), 'Received expected HTTP status line.'); $this->assertErrorMessage($error_exception); $this->drupalGet('error-test/trigger-pdo-exception'); - $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), t('Received expected HTTP status line.')); + $this->assertTrue(strpos($this->drupalGetHeader(':status'), '500 Service unavailable (with message)'), 'Received expected HTTP status line.'); // We cannot use assertErrorMessage() since the extact error reported // varies from database to database. Check that the SQL string is displayed. - $this->assertText($error_pdo_exception['%type'], t('Found %type in error page.', $error_pdo_exception)); - $this->assertText($error_pdo_exception['!message'], t('Found !message in error page.', $error_pdo_exception)); - $error_details = t('in %function (line ', $error_pdo_exception); - $this->assertRaw($error_details, t("Found '!message' in error page.", array('!message' => $error_details))); + $this->assertText($error_pdo_exception['%type'], format_string('Found %type in error page.', $error_pdo_exception)); + $this->assertText($error_pdo_exception['!message'], format_string('Found !message in error page.', $error_pdo_exception)); + $error_details = format_string('in %function (line ', $error_pdo_exception); + $this->assertRaw($error_details, format_string("Found '!message' in error page.", array('!message' => $error_details))); } /** @@ -102,7 +102,7 @@ class DrupalErrorHandlerTestCase extends DrupalWebTestCase { */ function assertErrorMessage(array $error) { $message = t('%type: !message in %function (line ', $error); - $this->assertRaw($message, t('Found error message: !message.', array('!message' => $message))); + $this->assertRaw($message, format_string('Found error message: !message.', array('!message' => $message))); } /** @@ -110,7 +110,7 @@ class DrupalErrorHandlerTestCase extends DrupalWebTestCase { */ function assertNoErrorMessage(array $error) { $message = t('%type: !message in %function (line ', $error); - $this->assertNoRaw($message, t('Did not find error message: !message.', array('!message' => $message))); + $this->assertNoRaw($message, format_string('Did not find error message: !message.', array('!message' => $message))); } } diff --git a/modules/simpletest/tests/password.test b/modules/simpletest/tests/password.test index e100c2ef6..5259d19e8 100644 --- a/modules/simpletest/tests/password.test +++ b/modules/simpletest/tests/password.test @@ -35,26 +35,26 @@ class PasswordHashingTest extends DrupalWebTestCase { $password = 'baz'; $account = (object) array('name' => 'foo', 'pass' => md5($password)); // The md5 password should be flagged as needing an update. - $this->assertTrue(user_needs_new_hash($account), t('User with md5 password needs a new hash.')); + $this->assertTrue(user_needs_new_hash($account), 'User with md5 password needs a new hash.'); // Re-hash the password. $old_hash = $account->pass; $account->pass = user_hash_password($password); - $this->assertIdentical(_password_get_count_log2($account->pass), DRUPAL_MIN_HASH_COUNT, t('Re-hashed password has the minimum number of log2 iterations.')); - $this->assertTrue($account->pass != $old_hash, t('Password hash changed.')); - $this->assertTrue(user_check_password($password, $account), t('Password check succeeds.')); + $this->assertIdentical(_password_get_count_log2($account->pass), DRUPAL_MIN_HASH_COUNT, 'Re-hashed password has the minimum number of log2 iterations.'); + $this->assertTrue($account->pass != $old_hash, 'Password hash changed.'); + $this->assertTrue(user_check_password($password, $account), 'Password check succeeds.'); // Since the log2 setting hasn't changed and the user has a valid password, // user_needs_new_hash() should return FALSE. - $this->assertFalse(user_needs_new_hash($account), t('User does not need a new hash.')); + $this->assertFalse(user_needs_new_hash($account), 'User does not need a new hash.'); // Increment the log2 iteration to MIN + 1. variable_set('password_count_log2', DRUPAL_MIN_HASH_COUNT + 1); - $this->assertTrue(user_needs_new_hash($account), t('User needs a new hash after incrementing the log2 count.')); + $this->assertTrue(user_needs_new_hash($account), 'User needs a new hash after incrementing the log2 count.'); // Re-hash the password. $old_hash = $account->pass; $account->pass = user_hash_password($password); - $this->assertIdentical(_password_get_count_log2($account->pass), DRUPAL_MIN_HASH_COUNT + 1, t('Re-hashed password has the correct number of log2 iterations.')); - $this->assertTrue($account->pass != $old_hash, t('Password hash changed again.')); + $this->assertIdentical(_password_get_count_log2($account->pass), DRUPAL_MIN_HASH_COUNT + 1, 'Re-hashed password has the correct number of log2 iterations.'); + $this->assertTrue($account->pass != $old_hash, 'Password hash changed again.'); // Now the hash should be OK. - $this->assertFalse(user_needs_new_hash($account), t('Re-hashed password does not need a new hash.')); - $this->assertTrue(user_check_password($password, $account), t('Password check succeeds with re-hashed password.')); + $this->assertFalse(user_needs_new_hash($account), 'Re-hashed password does not need a new hash.'); + $this->assertTrue(user_check_password($password, $account), 'Password check succeeds with re-hashed password.'); } } diff --git a/modules/simpletest/tests/unicode.test b/modules/simpletest/tests/unicode.test index cf7991b6c..4aaf26db7 100644 --- a/modules/simpletest/tests/unicode.test +++ b/modules/simpletest/tests/unicode.test @@ -80,7 +80,7 @@ class UnicodeUnitTest extends DrupalUnitTestCase { } foreach ($testcase as $input => $output) { - $this->assertEqual(drupal_strtolower($input), $output, t('%input is lowercased as %output', array('%input' => $input, '%output' => $output))); + $this->assertEqual(drupal_strtolower($input), $output, format_string('%input is lowercased as %output', array('%input' => $input, '%output' => $output))); } } @@ -94,7 +94,7 @@ class UnicodeUnitTest extends DrupalUnitTestCase { } foreach ($testcase as $input => $output) { - $this->assertEqual(drupal_strtoupper($input), $output, t('%input is uppercased as %output', array('%input' => $input, '%output' => $output))); + $this->assertEqual(drupal_strtoupper($input), $output, format_string('%input is uppercased as %output', array('%input' => $input, '%output' => $output))); } } @@ -110,7 +110,7 @@ class UnicodeUnitTest extends DrupalUnitTestCase { } foreach ($testcase as $input => $output) { - $this->assertEqual(drupal_ucfirst($input), $output, t('%input is ucfirst-ed as %output', array('%input' => $input, '%output' => $output))); + $this->assertEqual(drupal_ucfirst($input), $output, format_string('%input is ucfirst-ed as %output', array('%input' => $input, '%output' => $output))); } } @@ -121,7 +121,7 @@ class UnicodeUnitTest extends DrupalUnitTestCase { ); foreach ($testcase as $input => $output) { - $this->assertEqual(drupal_strlen($input), $output, t('%input length is %output', array('%input' => $input, '%output' => $output))); + $this->assertEqual(drupal_strlen($input), $output, format_string('%input length is %output', array('%input' => $input, '%output' => $output))); } } @@ -181,7 +181,7 @@ class UnicodeUnitTest extends DrupalUnitTestCase { foreach ($testcase as $test) { list($input, $start, $length, $output) = $test; $result = drupal_substr($input, $start, $length); - $this->assertEqual($result, $output, t('%input substring at offset %offset for %length characters is %output (got %result)', array('%input' => $input, '%offset' => $start, '%length' => $length, '%output' => $output, '%result' => $result))); + $this->assertEqual($result, $output, format_string('%input substring at offset %offset for %length characters is %output (got %result)', array('%input' => $input, '%offset' => $start, '%length' => $length, '%output' => $output, '%result' => $result))); } } @@ -213,7 +213,7 @@ class UnicodeUnitTest extends DrupalUnitTestCase { '€' => '€', ); foreach ($testcase as $input => $output) { - $this->assertEqual(decode_entities($input), $output, t('Make sure the decoded entity of @input is @output', array('@input' => $input, '@output' => $output))); + $this->assertEqual(decode_entities($input), $output, format_string('Make sure the decoded entity of @input is @output', array('@input' => $input, '@output' => $output))); } } @@ -299,7 +299,7 @@ class UnicodeUnitTest extends DrupalUnitTestCase { foreach ($cases as $case) { list($input, $max_length, $expected) = $case; $output = truncate_utf8($input, $max_length, $wordsafe, $ellipsis); - $this->assertEqual($output, $expected, t('%input truncate to %length characters with %wordsafe, %ellipsis is %expected (got %output)', array('%input' => $input, '%length' => $max_length, '%output' => $output, '%expected' => $expected, '%wordsafe' => ($wordsafe ? 'word-safe' : 'not word-safe'), '%ellipsis' => ($ellipsis ? 'ellipsis' : 'not ellipsis')))); + $this->assertEqual($output, $expected, format_string('%input truncate to %length characters with %wordsafe, %ellipsis is %expected (got %output)', array('%input' => $input, '%length' => $max_length, '%output' => $output, '%expected' => $expected, '%wordsafe' => ($wordsafe ? 'word-safe' : 'not word-safe'), '%ellipsis' => ($ellipsis ? 'ellipsis' : 'not ellipsis')))); } } } |