summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/tests')
-rw-r--r--modules/simpletest/tests/actions.test20
-rw-r--r--modules/simpletest/tests/ajax.test32
-rw-r--r--modules/simpletest/tests/batch.test70
-rw-r--r--modules/simpletest/tests/bootstrap.test164
-rw-r--r--modules/simpletest/tests/cache.test65
-rw-r--r--modules/simpletest/tests/common.test458
-rw-r--r--modules/simpletest/tests/database_test.test629
-rw-r--r--modules/simpletest/tests/entity_query.test146
-rw-r--r--modules/simpletest/tests/error.test20
-rw-r--r--modules/simpletest/tests/file.test646
-rw-r--r--modules/simpletest/tests/filetransfer.test2
-rw-r--r--modules/simpletest/tests/form.test192
-rw-r--r--modules/simpletest/tests/graph.test12
-rw-r--r--modules/simpletest/tests/image.test72
-rw-r--r--modules/simpletest/tests/lock.test20
-rw-r--r--modules/simpletest/tests/mail.test2
-rw-r--r--modules/simpletest/tests/menu.test156
-rw-r--r--modules/simpletest/tests/module.test28
-rw-r--r--modules/simpletest/tests/path.test10
-rw-r--r--modules/simpletest/tests/registry.test6
-rw-r--r--modules/simpletest/tests/schema.test42
-rw-r--r--modules/simpletest/tests/session.test72
-rw-r--r--modules/simpletest/tests/theme.test36
-rw-r--r--modules/simpletest/tests/unicode.test22
-rw-r--r--modules/simpletest/tests/update.test18
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.poll.test14
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.test13
-rw-r--r--modules/simpletest/tests/xmlrpc.test4
28 files changed, 1474 insertions, 1497 deletions
diff --git a/modules/simpletest/tests/actions.test b/modules/simpletest/tests/actions.test
index 8e0220d4f..5d279daa7 100644
--- a/modules/simpletest/tests/actions.test
+++ b/modules/simpletest/tests/actions.test
@@ -32,8 +32,8 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/config/system/actions/configure/' . drupal_hash_base64('system_goto_action'), $edit, t('Save'));
// Make sure that the new complex action was saved properly.
- $this->assertText(t('The action has been successfully saved.'), t("Make sure we get a confirmation that we've successfully saved the complex action."));
- $this->assertText($action_label, t("Make sure the action label appears on the configuration page after we've saved the complex action."));
+ $this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully saved the complex action.");
+ $this->assertText($action_label, "Make sure the action label appears on the configuration page after we've saved the complex action.");
// Make another POST request to the action edit page.
$this->clickLink(t('configure'));
@@ -46,9 +46,9 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, t('Save'));
// Make sure that the action updated properly.
- $this->assertText(t('The action has been successfully saved.'), t("Make sure we get a confirmation that we've successfully updated the complex action."));
- $this->assertNoText($action_label, t("Make sure the old action label does NOT appear on the configuration page after we've updated the complex action."));
- $this->assertText($new_action_label, t("Make sure the action label appears on the configuration page after we've updated the complex action."));
+ $this->assertText(t('The action has been successfully saved.'), "Make sure we get a confirmation that we've successfully updated the complex action.");
+ $this->assertNoText($action_label, "Make sure the old action label does NOT appear on the configuration page after we've updated the complex action.");
+ $this->assertText($new_action_label, "Make sure the action label appears on the configuration page after we've updated the complex action.");
// Make sure that deletions work properly.
$this->clickLink(t('delete'));
@@ -56,11 +56,11 @@ class ActionsConfigurationTestCase extends DrupalWebTestCase {
$this->drupalPost("admin/config/system/actions/delete/$aid", $edit, t('Delete'));
// Make sure that the action was actually deleted.
- $this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_label)), t('Make sure that we get a delete confirmation message.'));
+ $this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_label)), 'Make sure that we get a delete confirmation message.');
$this->drupalGet('admin/config/system/actions/manage');
- $this->assertNoText($new_action_label, t("Make sure the action label does not appear on the overview page after we've deleted the action."));
+ $this->assertNoText($new_action_label, "Make sure the action label does not appear on the overview page after we've deleted the action.");
$exists = db_query('SELECT aid FROM {actions} WHERE callback = :callback', array(':callback' => 'drupal_goto_action'))->fetchField();
- $this->assertFalse($exists, t('Make sure the action is gone from the database after being deleted.'));
+ $this->assertFalse($exists, 'Make sure the action is gone from the database after being deleted.');
}
}
@@ -120,8 +120,8 @@ class ActionLoopTestCase extends DrupalWebTestCase {
$loop_started = FALSE;
foreach ($result as $row) {
$expected_message = array_shift($expected);
- $this->assertEqual($row->message, $expected_message, t('Expected message %expected, got %message.', array('%expected' => $expected_message, '%message' => $row->message)));
+ $this->assertEqual($row->message, $expected_message, 'Expected message ' . $expected_message . ', got ' . $row->message . '.');
}
- $this->assertTrue(empty($expected), t('All expected messages found.'));
+ $this->assertTrue(empty($expected), 'All expected messages found.');
}
}
diff --git a/modules/simpletest/tests/ajax.test b/modules/simpletest/tests/ajax.test
index 91572bda0..e711eec37 100644
--- a/modules/simpletest/tests/ajax.test
+++ b/modules/simpletest/tests/ajax.test
@@ -44,9 +44,9 @@ class AJAXFrameworkTestCase extends AJAXTestCase {
function testAJAXRender() {
$result = $this->drupalGetAJAX('ajax-test/render');
// Verify that JavaScript settings are contained (always first).
- $this->assertIdentical($result[0]['command'], 'settings', t('drupal_add_js() settings are contained first.'));
+ $this->assertIdentical($result[0]['command'], 'settings', 'drupal_add_js() settings are contained first.');
// Verify that basePath is contained in JavaScript settings.
- $this->assertEqual($result[0]['settings']['basePath'], base_path(), t('Base path is contained in JavaScript settings.'));
+ $this->assertEqual($result[0]['settings']['basePath'], base_path(), 'Base path is contained in JavaScript settings.');
}
/**
@@ -55,14 +55,14 @@ class AJAXFrameworkTestCase extends AJAXTestCase {
function testAJAXRenderError() {
$result = $this->discardSettings($this->drupalGetAJAX('ajax-test/render-error'));
// Verify default error message.
- $this->assertEqual($result[0]['command'], 'alert', t('ajax_render_error() invokes alert command.'));
- $this->assertEqual($result[0]['text'], t('An error occurred while handling the request: The server received invalid input.'), t('Default error message is output.'));
+ $this->assertEqual($result[0]['command'], 'alert', 'ajax_render_error() invokes alert command.');
+ $this->assertEqual($result[0]['text'], t('An error occurred while handling the request: The server received invalid input.'), 'Default error message is output.');
// Verify custom error message.
$edit = array(
'message' => 'Custom error message.',
);
$result = $this->discardSettings($this->drupalGetAJAX('ajax-test/render-error', array('query' => $edit)));
- $this->assertEqual($result[0]['text'], $edit['message'], t('Custom error message is output.'));
+ $this->assertEqual($result[0]['text'], $edit['message'], 'Custom error message is output.');
}
}
@@ -86,9 +86,9 @@ class AJAXCommandsTestCase extends AJAXTestCase {
$commands[] = ajax_command_settings(array('foo' => 42));
$result = $this->drupalGetAJAX('ajax-test/render', array('query' => array('commands' => $commands)));
// Verify that JavaScript settings are contained (always first).
- $this->assertIdentical($result[0]['command'], 'settings', t('drupal_add_js() settings are contained first.'));
+ $this->assertIdentical($result[0]['command'], 'settings', 'drupal_add_js() settings are contained first.');
// Verify that the custom setting is contained.
- $this->assertEqual($result[1]['settings']['foo'], 42, t('Custom setting is output.'));
+ $this->assertEqual($result[1]['settings']['foo'], 42, 'Custom setting is output.');
}
/**
@@ -192,7 +192,7 @@ class AJAXFormValuesTestCase extends AJAXTestCase {
*/
function testSimpleAJAXFormValue() {
// Verify form values of a select element.
- foreach(array('red', 'green', 'blue') as $item) {
+ foreach (array('red', 'green', 'blue') as $item) {
$edit = array(
'select' => $item,
);
@@ -202,7 +202,7 @@ class AJAXFormValuesTestCase extends AJAXTestCase {
}
// Verify form values of a checkbox element.
- foreach(array(FALSE, TRUE) as $item) {
+ foreach (array(FALSE, TRUE) as $item) {
$edit = array(
'checkbox' => $item,
);
@@ -270,8 +270,8 @@ class AJAXMultiFormTestCase extends AJAXTestCase {
// each form.
$this->drupalGet('form-test/two-instances-of-same-form');
foreach ($field_xpaths as $form_id => $field_xpath) {
- $this->assert(count($this->xpath($field_xpath . $field_items_xpath_suffix)) == 1, t('Found the correct number of field items on the initial page.'));
- $this->assertFieldByXPath($field_xpath . $button_xpath_suffix, NULL, t('Found the "add more" button on the initial page.'));
+ $this->assert(count($this->xpath($field_xpath . $field_items_xpath_suffix)) == 1, 'Found the correct number of field items on the initial page.');
+ $this->assertFieldByXPath($field_xpath . $button_xpath_suffix, NULL, 'Found the "add more" button on the initial page.');
}
$this->assertNoDuplicateIds(t('Initial page contains unique IDs'), 'Other');
@@ -282,13 +282,13 @@ class AJAXMultiFormTestCase extends AJAXTestCase {
preg_match('/jQuery\.extend\(Drupal\.settings, (.*?)\);/', $this->content, $matches);
$settings = drupal_json_decode($matches[1]);
foreach ($field_xpaths as $form_id => $field_xpath) {
- for ($i=0; $i<2; $i++) {
+ for ($i = 0; $i < 2; $i++) {
$button = $this->xpath($field_xpath . $button_xpath_suffix);
$button_id = (string) $button[0]['id'];
$commands = $this->drupalPostAJAX(NULL, array(), array($button_name => $button_value), 'system/ajax', array(), array(), $form_id, $settings['ajax'][$button_id]);
$settings = array_merge_recursive($settings, $commands[0]['settings']);
- $this->assert(count($this->xpath($field_xpath . $field_items_xpath_suffix)) == $i+2, t('Found the correct number of field items after an AJAX submission.'));
- $this->assertFieldByXPath($field_xpath . $button_xpath_suffix, NULL, t('Found the "add more" button after an AJAX submission.'));
+ $this->assert(count($this->xpath($field_xpath . $field_items_xpath_suffix)) == $i + 2, 'Found the correct number of field items after an AJAX submission.');
+ $this->assertFieldByXPath($field_xpath . $button_xpath_suffix, NULL, 'Found the "add more" button after an AJAX submission.');
$this->assertNoDuplicateIds(t('Updated page contains unique IDs'), 'Other');
}
}
@@ -322,8 +322,8 @@ class AJAXElementValidation extends AJAXTestCase {
// Post with 'drivertext' as the triggering element.
$post_result = $this->drupalPostAJAX('ajax_validation_test', $edit, 'drivertext');
// Look for a validation failure in the resultant JSON.
- $this->assertNoText(t('Error message'), t("No error message in resultant JSON"));
- $this->assertText('ajax_forms_test_validation_form_callback invoked', t('The correct callback was invoked'));
+ $this->assertNoText(t('Error message'), "No error message in resultant JSON");
+ $this->assertText('ajax_forms_test_validation_form_callback invoked', 'The correct callback was invoked');
}
}
diff --git a/modules/simpletest/tests/batch.test b/modules/simpletest/tests/batch.test
index 451575cf2..f14f56ba9 100644
--- a/modules/simpletest/tests/batch.test
+++ b/modules/simpletest/tests/batch.test
@@ -28,9 +28,9 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
function testBatchNoForm() {
// Displaying the page triggers batch 1.
$this->drupalGet('batch_test/no_form');
- $this->assertBatchMessages($this->_resultMessages(1), t('Batch for step 2 performed successfully.'));
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), t('Execution order was correct.'));
- $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
+ $this->assertBatchMessages($this->_resultMessages(1), 'Batch for step 2 performed successfully.');
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
+ $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
}
/**
@@ -40,36 +40,36 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
// Batch 0: no operation.
$edit = array('batch' => 'batch_0');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_0'), t('Batch with no operation performed successfully.'));
- $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
+ $this->assertBatchMessages($this->_resultMessages('batch_0'), 'Batch with no operation performed successfully.');
+ $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
// Batch 1: several simple operations.
$edit = array('batch' => 'batch_1');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_1'), t('Batch with simple operations performed successfully.'));
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), t('Execution order was correct.'));
- $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
+ $this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch with simple operations performed successfully.');
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
+ $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
// Batch 2: one multistep operation.
$edit = array('batch' => 'batch_2');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_2'), t('Batch with multistep operation performed successfully.'));
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), t('Execution order was correct.'));
- $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
+ $this->assertBatchMessages($this->_resultMessages('batch_2'), 'Batch with multistep operation performed successfully.');
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), 'Execution order was correct.');
+ $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
// Batch 3: simple + multistep combined.
$edit = array('batch' => 'batch_3');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_3'), t('Batch with simple and multistep operations performed successfully.'));
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_3'), t('Execution order was correct.'));
- $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
+ $this->assertBatchMessages($this->_resultMessages('batch_3'), 'Batch with simple and multistep operations performed successfully.');
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_3'), 'Execution order was correct.');
+ $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
// Batch 4: nested batch.
$edit = array('batch' => 'batch_4');
$this->drupalPost('batch_test/simple', $edit, 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_4'), t('Nested batch performed successfully.'));
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_4'), t('Execution order was correct.'));
- $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
+ $this->assertBatchMessages($this->_resultMessages('batch_4'), 'Nested batch performed successfully.');
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_4'), 'Execution order was correct.');
+ $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
}
/**
@@ -77,19 +77,19 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
*/
function testBatchFormMultistep() {
$this->drupalGet('batch_test/multistep');
- $this->assertText('step 1', t('Form is displayed in step 1.'));
+ $this->assertText('step 1', 'Form is displayed in step 1.');
// First step triggers batch 1.
$this->drupalPost(NULL, array(), 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_1'), t('Batch for step 1 performed successfully.'));
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), t('Execution order was correct.'));
- $this->assertText('step 2', t('Form is displayed in step 2.'));
+ $this->assertBatchMessages($this->_resultMessages('batch_1'), 'Batch for step 1 performed successfully.');
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_1'), 'Execution order was correct.');
+ $this->assertText('step 2', 'Form is displayed in step 2.');
// Second step triggers batch 2.
$this->drupalPost(NULL, array(), 'Submit');
- $this->assertBatchMessages($this->_resultMessages('batch_2'), t('Batch for step 2 performed successfully.'));
- $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), t('Execution order was correct.'));
- $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
+ $this->assertBatchMessages($this->_resultMessages('batch_2'), 'Batch for step 2 performed successfully.');
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('batch_2'), 'Execution order was correct.');
+ $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
}
/**
@@ -102,11 +102,11 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
$edit = array('value' => $value);
$this->drupalPost('batch_test/chained', $edit, 'Submit');
// Check that result messages are present and in the correct order.
- $this->assertBatchMessages($this->_resultMessages('chained'), t('Batches defined in separate submit handlers performed successfully.'));
+ $this->assertBatchMessages($this->_resultMessages('chained'), 'Batches defined in separate submit handlers performed successfully.');
// The stack contains execution order of batch callbacks and submit
// hanlders and logging of corresponding $form_state[{values'].
- $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), t('Execution order was correct, and $form_state is correctly persisted.'));
- $this->assertText('Redirection successful.', t('Redirection after batch execution is correct.'));
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), 'Execution order was correct, and $form_state is correctly persisted.');
+ $this->assertText('Redirection successful.', 'Redirection after batch execution is correct.');
}
/**
@@ -120,11 +120,11 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
$value = rand(0, 255);
$this->drupalGet('batch_test/programmatic/' . $value);
// Check that result messages are present and in the correct order.
- $this->assertBatchMessages($this->_resultMessages('chained'), t('Batches defined in separate submit handlers performed successfully.'));
+ $this->assertBatchMessages($this->_resultMessages('chained'), 'Batches defined in separate submit handlers performed successfully.');
// The stack contains execution order of batch callbacks and submit
// hanlders and logging of corresponding $form_state[{values'].
- $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), t('Execution order was correct, and $form_state is correctly persisted.'));
- $this->assertText('Got out of a programmatic batched form.', t('Page execution continues normally.'));
+ $this->assertEqual(batch_test_stack(), $this->_resultStack('chained', $value), 'Execution order was correct, and $form_state is correctly persisted.');
+ $this->assertText('Got out of a programmatic batched form.', 'Page execution continues normally.');
}
/**
@@ -135,7 +135,7 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
// form.
$value = rand(0, 255);
$this->drupalGet('batch_test/nested_programmatic/' . $value);
- $this->assertEqual(batch_test_stack(), array('mock form submitted with value = ' . $value), t('drupal_form_submit() ran successfully within a batch operation.'));
+ $this->assertEqual(batch_test_stack(), array('mock form submitted with value = ' . $value), 'drupal_form_submit() ran successfully within a batch operation.');
}
/**
@@ -149,7 +149,7 @@ class BatchProcessingTestCase extends DrupalWebTestCase {
* TRUE on pass, FALSE on fail.
*/
function assertBatchMessages($texts, $message) {
- $pattern = '|' . implode('.*', $texts) .'|s';
+ $pattern = '|' . implode('.*', $texts) . '|s';
return $this->assertPattern($pattern, $message);
}
@@ -282,7 +282,7 @@ class BatchPageTestCase extends DrupalWebTestCase {
// administrative page.
$this->drupalGet('admin/batch_test/test_theme');
// The stack should contain the name of the the used on the progress page.
- $this->assertEqual(batch_test_stack(), array('seven'), t('A progressive batch correctly uses the theme of the page that started the batch.'));
+ $this->assertEqual(batch_test_stack(), array('seven'), 'A progressive batch correctly uses the theme of the page that started the batch.');
}
}
@@ -357,10 +357,10 @@ class BatchPercentagesUnitTestCase extends DrupalUnitTestCase {
$current = $arguments['current'];
$actual_result = _batch_api_percentage($total, $current);
if ($actual_result === $expected_result) {
- $this->pass(t('Expected the batch api percentage at the state @numerator/@denominator to be @expected%, and got @actual%.', array('@numerator' => $current, '@denominator' => $total, '@expected' => $expected_result, '@actual' => $actual_result)));
+ $this->pass('Expected the batch api percentage at the state ' . $current . '/' . $total . ' to be ' . $expected_result . '%, and got ' . $actual_result . '%.');
}
else {
- $this->fail(t('Expected the batch api percentage at the state @numerator/@denominator to be @expected%, but got @actual%.', array('@numerator' => $current, '@denominator' => $total, '@expected' => $expected_result, '@actual' => $actual_result)));
+ $this->fail('Expected the batch api percentage at the state ' . $current . '/' . $total . ' to be ' . $expected_result . '%, but got ' . $actual_result . '%.');
}
}
}
diff --git a/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test
index d8a9d8c1b..d41ecf333 100644
--- a/modules/simpletest/tests/bootstrap.test
+++ b/modules/simpletest/tests/bootstrap.test
@@ -42,60 +42,48 @@ class BootstrapIPAddressTestCase extends DrupalWebTestCase {
function testIPAddressHost() {
// Test the normal IP address.
$this->assertTrue(
- ip_address() == $this->remote_ip,
- t('Got remote IP address.')
- );
+ ip_address() == $this->remote_ip, 'Got remote IP address.');
// Proxy forwarding on but no proxy addresses defined.
variable_set('reverse_proxy', 1);
$this->assertTrue(
- ip_address() == $this->remote_ip,
- t('Proxy forwarding without trusted proxies got remote IP address.')
- );
+ ip_address() == $this->remote_ip, 'Proxy forwarding without trusted proxies got remote IP address.');
// Proxy forwarding on and proxy address not trusted.
variable_set('reverse_proxy_addresses', array($this->proxy_ip, $this->proxy2_ip));
drupal_static_reset('ip_address');
$_SERVER['REMOTE_ADDR'] = $this->untrusted_ip;
$this->assertTrue(
- ip_address() == $this->untrusted_ip,
- t('Proxy forwarding with untrusted proxy got remote IP address.')
- );
+ ip_address() == $this->untrusted_ip, 'Proxy forwarding with untrusted proxy got remote IP address.');
// Proxy forwarding on and proxy address trusted.
$_SERVER['REMOTE_ADDR'] = $this->proxy_ip;
$_SERVER['HTTP_X_FORWARDED_FOR'] = $this->forwarded_ip;
drupal_static_reset('ip_address');
$this->assertTrue(
- ip_address() == $this->forwarded_ip,
- t('Proxy forwarding with trusted proxy got forwarded IP address.')
- );
+ ip_address() == $this->forwarded_ip, 'Proxy forwarding with trusted proxy got forwarded IP address.');
// Multi-tier architecture with comma separated values in header.
$_SERVER['REMOTE_ADDR'] = $this->proxy_ip;
$_SERVER['HTTP_X_FORWARDED_FOR'] = implode(', ', array($this->untrusted_ip, $this->forwarded_ip, $this->proxy2_ip));
drupal_static_reset('ip_address');
$this->assertTrue(
- ip_address() == $this->forwarded_ip,
- t('Proxy forwarding with trusted 2-tier proxy got forwarded IP address.')
- );
+ ip_address() == $this->forwarded_ip, 'Proxy forwarding with trusted 2-tier proxy got forwarded IP address.');
// Custom client-IP header.
variable_set('reverse_proxy_header', 'HTTP_X_CLUSTER_CLIENT_IP');
$_SERVER['HTTP_X_CLUSTER_CLIENT_IP'] = $this->cluster_ip;
drupal_static_reset('ip_address');
$this->assertTrue(
- ip_address() == $this->cluster_ip,
- t('Cluster environment got cluster client IP.')
- );
+ ip_address() == $this->cluster_ip, 'Cluster environment got cluster client IP.');
// Verifies that drupal_valid_http_host() prevents invalid characters.
- $this->assertFalse(drupal_valid_http_host('security/.drupal.org:80'), t('HTTP_HOST with / is invalid'));
- $this->assertFalse(drupal_valid_http_host('security\\.drupal.org:80'), t('HTTP_HOST with \\ is invalid'));
- $this->assertFalse(drupal_valid_http_host('security<.drupal.org:80'), t('HTTP_HOST with &lt; is invalid'));
- $this->assertFalse(drupal_valid_http_host('security..drupal.org:80'), t('HTTP_HOST with .. is invalid'));
+ $this->assertFalse(drupal_valid_http_host('security/.drupal.org:80'), 'HTTP_HOST with / is invalid');
+ $this->assertFalse(drupal_valid_http_host('security\\.drupal.org:80'), 'HTTP_HOST with \\ is invalid');
+ $this->assertFalse(drupal_valid_http_host('security<.drupal.org:80'), 'HTTP_HOST with &lt; is invalid');
+ $this->assertFalse(drupal_valid_http_host('security..drupal.org:80'), 'HTTP_HOST with .. is invalid');
// IPv6 loopback address
- $this->assertTrue(drupal_valid_http_host('[::1]:80'), t('HTTP_HOST containing IPv6 loopback is valid'));
+ $this->assertTrue(drupal_valid_http_host('[::1]:80'), 'HTTP_HOST containing IPv6 loopback is valid');
}
}
@@ -123,32 +111,32 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
$this->drupalGet('');
$this->drupalHead('');
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
$etag = $this->drupalGetHeader('ETag');
$last_modified = $this->drupalGetHeader('Last-Modified');
$this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified, 'If-None-Match: ' . $etag));
- $this->assertResponse(304, t('Conditional request returned 304 Not Modified.'));
+ $this->assertResponse(304, 'Conditional request returned 304 Not Modified.');
$this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC822, strtotime($last_modified)), 'If-None-Match: ' . $etag));
- $this->assertResponse(304, t('Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.'));
+ $this->assertResponse(304, 'Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.');
$this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC850, strtotime($last_modified)), 'If-None-Match: ' . $etag));
- $this->assertResponse(304, t('Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.'));
+ $this->assertResponse(304, 'Conditional request with obsolete If-Modified-Since date returned 304 Not Modified.');
$this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified));
- $this->assertResponse(200, t('Conditional request without If-None-Match returned 200 OK.'));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
+ $this->assertResponse(200, 'Conditional request without If-None-Match returned 200 OK.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
$this->drupalGet('', array(), array('If-Modified-Since: ' . gmdate(DATE_RFC1123, strtotime($last_modified) + 1), 'If-None-Match: ' . $etag));
- $this->assertResponse(200, t('Conditional request with new a If-Modified-Since date newer than Last-Modified returned 200 OK.'));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
+ $this->assertResponse(200, 'Conditional request with new a If-Modified-Since date newer than Last-Modified returned 200 OK.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
$user = $this->drupalCreateUser();
$this->drupalLogin($user);
$this->drupalGet('', array(), array('If-Modified-Since: ' . $last_modified, 'If-None-Match: ' . $etag));
- $this->assertResponse(200, t('Conditional request returned 200 OK for authenticated user.'));
- $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), t('Absense of Page was not cached.'));
+ $this->assertResponse(200, 'Conditional request returned 200 OK for authenticated user.');
+ $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Absense of Page was not cached.');
}
/**
@@ -159,35 +147,35 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
// Fill the cache.
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar')));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', t('Page was not cached.'));
- $this->assertEqual($this->drupalGetHeader('Vary'), 'Cookie,Accept-Encoding', t('Vary header was sent.'));
- $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'public, max-age=0', t('Cache-Control header was sent.'));
- $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', t('Expires header was sent.'));
- $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', t('Custom header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
+ $this->assertEqual($this->drupalGetHeader('Vary'), 'Cookie,Accept-Encoding', 'Vary header was sent.');
+ $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'public, max-age=0', 'Cache-Control header was sent.');
+ $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.');
+ $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', 'Custom header was sent.');
// Check cache.
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar')));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
- $this->assertEqual($this->drupalGetHeader('Vary'), 'Cookie,Accept-Encoding', t('Vary: Cookie header was sent.'));
- $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'public, max-age=0', t('Cache-Control header was sent.'));
- $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', t('Expires header was sent.'));
- $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', t('Custom header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
+ $this->assertEqual($this->drupalGetHeader('Vary'), 'Cookie,Accept-Encoding', 'Vary: Cookie header was sent.');
+ $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'public, max-age=0', 'Cache-Control header was sent.');
+ $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.');
+ $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', 'Custom header was sent.');
// Check replacing default headers.
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Expires', 'value' => 'Fri, 19 Nov 2008 05:00:00 GMT')));
- $this->assertEqual($this->drupalGetHeader('Expires'), 'Fri, 19 Nov 2008 05:00:00 GMT', t('Default header was replaced.'));
+ $this->assertEqual($this->drupalGetHeader('Expires'), 'Fri, 19 Nov 2008 05:00:00 GMT', 'Default header was replaced.');
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Vary', 'value' => 'User-Agent')));
- $this->assertEqual($this->drupalGetHeader('Vary'), 'User-Agent,Accept-Encoding', t('Default header was replaced.'));
+ $this->assertEqual($this->drupalGetHeader('Vary'), 'User-Agent,Accept-Encoding', 'Default header was replaced.');
// Check that authenticated users bypass the cache.
$user = $this->drupalCreateUser();
$this->drupalLogin($user);
$this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar')));
- $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), t('Caching was bypassed.'));
- $this->assertTrue(strpos($this->drupalGetHeader('Vary'), 'Cookie') === FALSE, t('Vary: Cookie header was not sent.'));
- $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate, post-check=0, pre-check=0', t('Cache-Control header was sent.'));
- $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', t('Expires header was sent.'));
- $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', t('Custom header was sent.'));
+ $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Caching was bypassed.');
+ $this->assertTrue(strpos($this->drupalGetHeader('Vary'), 'Cookie') === FALSE, 'Vary: Cookie header was not sent.');
+ $this->assertEqual($this->drupalGetHeader('Cache-Control'), 'no-cache, must-revalidate, post-check=0, pre-check=0', 'Cache-Control header was sent.');
+ $this->assertEqual($this->drupalGetHeader('Expires'), 'Sun, 19 Nov 1978 05:00:00 GMT', 'Expires header was sent.');
+ $this->assertEqual($this->drupalGetHeader('Foo'), 'bar', 'Custom header was sent.');
}
@@ -203,23 +191,23 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase {
// Fill the cache and verify that output is compressed.
$this->drupalGet('', array(), array('Accept-Encoding: gzip,deflate'));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', t('Page was not cached.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
$this->drupalSetContent(gzinflate(substr($this->drupalGetContent(), 10, -8)));
- $this->assertRaw('</html>', t('Page was gzip compressed.'));
+ $this->assertRaw('</html>', 'Page was gzip compressed.');
// Verify that cached output is compressed.
$this->drupalGet('', array(), array('Accept-Encoding: gzip,deflate'));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
- $this->assertEqual($this->drupalGetHeader('Content-Encoding'), 'gzip', t('A Content-Encoding header was sent.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
+ $this->assertEqual($this->drupalGetHeader('Content-Encoding'), 'gzip', 'A Content-Encoding header was sent.');
$this->drupalSetContent(gzinflate(substr($this->drupalGetContent(), 10, -8)));
- $this->assertRaw('</html>', t('Page was gzip compressed.'));
+ $this->assertRaw('</html>', 'Page was gzip compressed.');
// Verify that a client without compression support gets an uncompressed page.
$this->drupalGet('');
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
- $this->assertFalse($this->drupalGetHeader('Content-Encoding'), t('A Content-Encoding header was not sent.'));
- $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), t('Site title matches.'));
- $this->assertRaw('</html>', t('Page was not compressed.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
+ $this->assertFalse($this->drupalGetHeader('Content-Encoding'), 'A Content-Encoding header was not sent.');
+ $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), 'Site title matches.');
+ $this->assertRaw('</html>', 'Page was not compressed.');
}
}
@@ -244,17 +232,17 @@ class BootstrapVariableTestCase extends DrupalWebTestCase {
// Setting and retrieving values.
$variable = $this->randomName();
variable_set('simpletest_bootstrap_variable_test', $variable);
- $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test'), t('Setting and retrieving values'));
+ $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test'), 'Setting and retrieving values');
// Make sure the variable persists across multiple requests.
$this->drupalGet('system-test/variable-get');
- $this->assertText($variable, t('Variable persists across multiple requests'));
+ $this->assertText($variable, 'Variable persists across multiple requests');
// Deleting variables.
$default_value = $this->randomName();
variable_del('simpletest_bootstrap_variable_test');
$variable = variable_get('simpletest_bootstrap_variable_test', $default_value);
- $this->assertIdentical($variable, $default_value, t('Deleting variables'));
+ $this->assertIdentical($variable, $default_value, 'Deleting variables');
}
/**
@@ -262,10 +250,10 @@ class BootstrapVariableTestCase extends DrupalWebTestCase {
*/
function testVariableDefaults() {
// Tests passing nothing through to the default.
- $this->assertIdentical(NULL, variable_get('simpletest_bootstrap_variable_test'), t('Variables are correctly defaulting to NULL.'));
+ $this->assertIdentical(NULL, variable_get('simpletest_bootstrap_variable_test'), 'Variables are correctly defaulting to NULL.');
// Tests passing 5 to the default parameter.
- $this->assertIdentical(5, variable_get('simpletest_bootstrap_variable_test', 5), t('The default variable parameter is passed through correctly.'));
+ $this->assertIdentical(5, variable_get('simpletest_bootstrap_variable_test', 5), 'The default variable parameter is passed through correctly.');
}
}
@@ -295,29 +283,29 @@ class HookBootExitTestCase extends DrupalWebTestCase {
variable_set('cache', 0);
$this->drupalGet('');
$calls = 1;
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot called with disabled cache.'));
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit called with disabled cache.'));
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, 'hook_boot called with disabled cache.');
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit called with disabled cache.');
// Test with normal cache. Boot and exit should be called.
variable_set('cache', 1);
$this->drupalGet('');
$calls++;
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot called with normal cache.'));
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit called with normal cache.'));
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, 'hook_boot called with normal cache.');
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit called with normal cache.');
// Boot and exit should not fire since the page is cached.
variable_set('page_cache_invoke_hooks', FALSE);
- $this->assertTrue(cache_get(url('', array('absolute' => TRUE)), 'cache_page'), t('Page has been cached.'));
+ $this->assertTrue(cache_get(url('', array('absolute' => TRUE)), 'cache_page'), 'Page has been cached.');
$this->drupalGet('');
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot not called with agressive cache and a cached page.'));
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit not called with agressive cache and a cached page.'));
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, 'hook_boot not called with agressive cache and a cached page.');
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit not called with agressive cache and a cached page.');
// Test with page cache cleared, boot and exit should be called.
- $this->assertTrue(db_delete('cache_page')->execute(), t('Page cache cleared.'));
+ $this->assertTrue(db_delete('cache_page')->execute(), 'Page cache cleared.');
$this->drupalGet('');
$calls++;
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot called with agressive cache and no cached page.'));
- $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit called with agressive cache and no cached page.'));
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, 'hook_boot called with agressive cache and no cached page.');
+ $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit called with agressive cache and no cached page.');
}
}
@@ -343,16 +331,16 @@ class BootstrapGetFilenameTestCase extends DrupalUnitTestCase {
drupal_static_reset('drupal_get_filename');
// Retrieving the location of a module.
- $this->assertIdentical(drupal_get_filename('module', 'php'), 'modules/php/php.module', t('Retrieve module location.'));
+ $this->assertIdentical(drupal_get_filename('module', 'php'), 'modules/php/php.module', 'Retrieve module location.');
// Retrieving the location of a theme.
- $this->assertIdentical(drupal_get_filename('theme', 'stark'), 'themes/stark/stark.info', t('Retrieve theme location.'));
+ $this->assertIdentical(drupal_get_filename('theme', 'stark'), 'themes/stark/stark.info', 'Retrieve theme location.');
// Retrieving the location of a theme engine.
- $this->assertIdentical(drupal_get_filename('theme_engine', 'phptemplate'), 'themes/engines/phptemplate/phptemplate.engine', t('Retrieve theme engine location.'));
+ $this->assertIdentical(drupal_get_filename('theme_engine', 'phptemplate'), 'themes/engines/phptemplate/phptemplate.engine', 'Retrieve theme engine location.');
// Retrieving a file that is definitely not stored in the database.
- $this->assertIdentical(drupal_get_filename('profile', 'standard'), 'profiles/standard/standard.profile', t('Retrieve install profile location.'));
+ $this->assertIdentical(drupal_get_filename('profile', 'standard'), 'profiles/standard/standard.profile', 'Retrieve install profile location.');
}
}
@@ -374,17 +362,17 @@ class BootstrapTimerTestCase extends DrupalUnitTestCase {
function testTimer() {
timer_start('test');
sleep(1);
- $this->assertTrue(timer_read('test') >= 1000, t('Timer measured 1 second of sleeping while running.'));
+ $this->assertTrue(timer_read('test') >= 1000, 'Timer measured 1 second of sleeping while running.');
sleep(1);
timer_stop('test');
- $this->assertTrue(timer_read('test') >= 2000, t('Timer measured 2 seconds of sleeping after being stopped.'));
+ $this->assertTrue(timer_read('test') >= 2000, 'Timer measured 2 seconds of sleeping after being stopped.');
timer_start('test');
sleep(1);
- $this->assertTrue(timer_read('test') >= 3000, t('Timer measured 3 seconds of sleeping after being restarted.'));
+ $this->assertTrue(timer_read('test') >= 3000, 'Timer measured 3 seconds of sleeping after being restarted.');
sleep(1);
$timer = timer_stop('test');
- $this->assertTrue(timer_read('test') >= 4000, t('Timer measured 4 seconds of sleeping after being stopped for a second time.'));
- $this->assertEqual($timer['count'], 2, t('Timer counted 2 instances of being started.'));
+ $this->assertTrue(timer_read('test') >= 4000, 'Timer measured 4 seconds of sleeping after being stopped for a second time.');
+ $this->assertEqual($timer['count'], 2, 'Timer counted 2 instances of being started.');
}
}
@@ -408,21 +396,21 @@ class BootstrapResettableStaticTestCase extends DrupalUnitTestCase {
function testDrupalStatic() {
$name = __CLASS__ . '_' . __METHOD__;
$var = &drupal_static($name, 'foo');
- $this->assertEqual($var, 'foo', t('Variable returned by drupal_static() was set to its default.'));
+ $this->assertEqual($var, 'foo', 'Variable returned by drupal_static() was set to its default.');
// Call the specific reset and the global reset each twice to ensure that
// multiple resets can be issued without odd side effects.
$var = 'bar';
drupal_static_reset($name);
- $this->assertEqual($var, 'foo', t('Variable was reset after first invocation of name-specific reset.'));
+ $this->assertEqual($var, 'foo', 'Variable was reset after first invocation of name-specific reset.');
$var = 'bar';
drupal_static_reset($name);
- $this->assertEqual($var, 'foo', t('Variable was reset after second invocation of name-specific reset.'));
+ $this->assertEqual($var, 'foo', 'Variable was reset after second invocation of name-specific reset.');
$var = 'bar';
drupal_static_reset();
- $this->assertEqual($var, 'foo', t('Variable was reset after first invocation of global reset.'));
+ $this->assertEqual($var, 'foo', 'Variable was reset after first invocation of global reset.');
$var = 'bar';
drupal_static_reset();
- $this->assertEqual($var, 'foo', t('Variable was reset after second invocation of global reset.'));
+ $this->assertEqual($var, 'foo', 'Variable was reset after second invocation of global reset.');
}
}
diff --git a/modules/simpletest/tests/cache.test b/modules/simpletest/tests/cache.test
index 0fc9fe298..b45dd85ec 100644
--- a/modules/simpletest/tests/cache.test
+++ b/modules/simpletest/tests/cache.test
@@ -135,7 +135,7 @@ class CacheSavingCase extends CacheTestCase {
* Test the saving and restoring of an array.
*/
function testArray() {
- $this->checkVariable(array('drupal1', 'drupal2' => 'drupal3', 'drupal4' => array('drupal5', 'drupal6')));
+ $this->checkVariable(array('drupal1','drupal2' => 'drupal3', 'drupal4' => array('drupal5', 'drupal6')));
}
/**
@@ -145,11 +145,11 @@ class CacheSavingCase extends CacheTestCase {
$test_object = new stdClass();
$test_object->test1 = $this->randomName(100);
$test_object->test2 = 100;
- $test_object->test3 = array('drupal1', 'drupal2' => 'drupal3', 'drupal4' => array('drupal5', 'drupal6'));
+ $test_object->test3 = array('drupal1','drupal2' => 'drupal3', 'drupal4' => array('drupal5', 'drupal6'));
cache_set('test_object', $test_object, 'cache');
$cache = cache_get('test_object', 'cache');
- $this->assertTrue(isset($cache->data) && $cache->data == $test_object, t('Object is saved and restored properly.'));
+ $this->assertTrue(isset($cache->data) && $cache->data == $test_object, 'Object is saved and restored properly.');
}
/*
@@ -158,7 +158,7 @@ class CacheSavingCase extends CacheTestCase {
function checkVariable($var) {
cache_set('test_var', $var, 'cache');
$cache = cache_get('test_var', 'cache');
- $this->assertTrue(isset($cache->data) && $cache->data === $var, t('@type is saved and restored properly.', array('@type' => ucfirst(gettype($var)))));
+ $this->assertTrue(isset($cache->data) && $cache->data === $var, ucfirst(gettype($var)) . ' is saved and restored properly.');
}
}
@@ -188,14 +188,14 @@ class CacheGetMultipleUnitTest extends CacheTestCase {
$item2 = $this->randomName(10);
cache_set('item1', $item1, $this->default_bin);
cache_set('item2', $item2, $this->default_bin);
- $this->assertTrue($this->checkCacheExists('item1', $item1), t('Item 1 is cached.'));
- $this->assertTrue($this->checkCacheExists('item2', $item2), t('Item 2 is cached.'));
+ $this->assertTrue($this->checkCacheExists('item1', $item1), 'Item 1 is cached.');
+ $this->assertTrue($this->checkCacheExists('item2', $item2), 'Item 2 is cached.');
// Fetch both records from the database with cache_get_multiple().
$item_ids = array('item1', 'item2');
$items = cache_get_multiple($item_ids, $this->default_bin);
- $this->assertEqual($items['item1']->data, $item1, t('Item was returned from cache successfully.'));
- $this->assertEqual($items['item2']->data, $item2, t('Item was returned from cache successfully.'));
+ $this->assertEqual($items['item1']->data, $item1, 'Item was returned from cache successfully.');
+ $this->assertEqual($items['item2']->data, $item2, 'Item was returned from cache successfully.');
// Remove one item from the cache.
cache_clear_all('item2', $this->default_bin);
@@ -203,9 +203,9 @@ class CacheGetMultipleUnitTest extends CacheTestCase {
// Confirm that only one item is returned by cache_get_multiple().
$item_ids = array('item1', 'item2');
$items = cache_get_multiple($item_ids, $this->default_bin);
- $this->assertEqual($items['item1']->data, $item1, t('Item was returned from cache successfully.'));
- $this->assertFalse(isset($items['item2']), t('Item was not returned from the cache.'));
- $this->assertTrue(count($items) == 1, t('Only valid cache entries returned.'));
+ $this->assertEqual($items['item1']->data, $item1, 'Item was returned from cache successfully.');
+ $this->assertFalse(isset($items['item2']), 'Item was not returned from the cache.');
+ $this->assertTrue(count($items) == 1, 'Only valid cache entries returned.');
}
}
@@ -237,17 +237,15 @@ class CacheClearCase extends CacheTestCase {
$this->assertCacheExists(t('Cache was set for clearing cid.'), $this->default_value, 'test_cid_clear');
cache_clear_all('test_cid_clear', $this->default_bin);
- $this->assertCacheRemoved(t('Cache was removed after clearing cid.'), 'test_cid_clear');
+ $this->assertCacheRemoved('Cache was removed after clearing cid.', 'test_cid_clear');
cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
- && $this->checkCacheExists('test_cid_clear2', $this->default_value),
- t('Two caches were created for checking cid "*" with wildcard false.'));
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches were created for checking cid "*" with wildcard false.');
cache_clear_all('*', $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
- && $this->checkCacheExists('test_cid_clear2', $this->default_value),
- t('Two caches still exists after clearing cid "*" with wildcard false.'));
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches still exists after clearing cid "*" with wildcard false.');
}
/**
@@ -257,22 +255,18 @@ class CacheClearCase extends CacheTestCase {
cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
- && $this->checkCacheExists('test_cid_clear2', $this->default_value),
- t('Two caches were created for checking cid "*" with wildcard true.'));
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches were created for checking cid "*" with wildcard true.');
cache_clear_all('*', $this->default_bin, TRUE);
$this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
- || $this->checkCacheExists('test_cid_clear2', $this->default_value),
- t('Two caches removed after clearing cid "*" with wildcard true.'));
+ || $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches removed after clearing cid "*" with wildcard true.');
cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
- && $this->checkCacheExists('test_cid_clear2', $this->default_value),
- t('Two caches were created for checking cid substring with wildcard true.'));
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches were created for checking cid substring with wildcard true.');
cache_clear_all('test_', $this->default_bin, TRUE);
$this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
- || $this->checkCacheExists('test_cid_clear2', $this->default_value),
- t('Two caches removed after clearing cid substring with wildcard true.'));
+ || $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two caches removed after clearing cid substring with wildcard true.');
}
/**
@@ -285,17 +279,14 @@ class CacheClearCase extends CacheTestCase {
cache_set('test_cid_clear3', $this->default_value, $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
&& $this->checkCacheExists('test_cid_clear2', $this->default_value)
- && $this->checkCacheExists('test_cid_clear3', $this->default_value),
- t('Three cache entries were created.'));
+ && $this->checkCacheExists('test_cid_clear3', $this->default_value), 'Three cache entries were created.');
// Clear two entries using an array.
cache_clear_all(array('test_cid_clear1', 'test_cid_clear2'), $this->default_bin);
$this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
- || $this->checkCacheExists('test_cid_clear2', $this->default_value),
- t('Two cache entries removed after clearing with an array.'));
+ || $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two cache entries removed after clearing with an array.');
- $this->assertTrue($this->checkCacheExists('test_cid_clear3', $this->default_value),
- t('Entry was not cleared from the cache'));
+ $this->assertTrue($this->checkCacheExists('test_cid_clear3', $this->default_value), 'Entry was not cleared from the cache');
// Set the cache clear threshold to 2 to confirm that the full bin is cleared
// when the threshold is exceeded.
@@ -303,13 +294,11 @@ class CacheClearCase extends CacheTestCase {
cache_set('test_cid_clear1', $this->default_value, $this->default_bin);
cache_set('test_cid_clear2', $this->default_value, $this->default_bin);
$this->assertTrue($this->checkCacheExists('test_cid_clear1', $this->default_value)
- && $this->checkCacheExists('test_cid_clear2', $this->default_value),
- t('Two cache entries were created.'));
+ && $this->checkCacheExists('test_cid_clear2', $this->default_value), 'Two cache entries were created.');
cache_clear_all(array('test_cid_clear1', 'test_cid_clear2', 'test_cid_clear3'), $this->default_bin);
$this->assertFalse($this->checkCacheExists('test_cid_clear1', $this->default_value)
|| $this->checkCacheExists('test_cid_clear2', $this->default_value)
- || $this->checkCacheExists('test_cid_clear3', $this->default_value),
- t('All cache entries removed when the array exceeded the cache clear threshold.'));
+ || $this->checkCacheExists('test_cid_clear3', $this->default_value), 'All cache entries removed when the array exceeded the cache clear threshold.');
}
}
@@ -338,14 +327,14 @@ class CacheIsEmptyCase extends CacheTestCase {
function testIsEmpty() {
// Clear the cache bin.
cache_clear_all('*', $this->default_bin);
- $this->assertTrue(cache_is_empty($this->default_bin), t('The cache bin is empty'));
+ $this->assertTrue(cache_is_empty($this->default_bin), 'The cache bin is empty');
// Add some data to the cache bin.
cache_set($this->default_cid, $this->default_value, $this->default_bin);
$this->assertCacheExists(t('Cache was set.'), $this->default_value, $this->default_cid);
- $this->assertFalse(cache_is_empty($this->default_bin), t('The cache bin is not empty'));
+ $this->assertFalse(cache_is_empty($this->default_bin), 'The cache bin is not empty');
// Remove the cached data.
cache_clear_all($this->default_cid, $this->default_bin);
- $this->assertCacheRemoved(t('Cache was removed.'), $this->default_cid);
- $this->assertTrue(cache_is_empty($this->default_bin), t('The cache bin is empty'));
+ $this->assertCacheRemoved('Cache was removed.', $this->default_cid);
+ $this->assertTrue(cache_is_empty($this->default_bin), 'The cache bin is empty');
}
}
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index 35c5bbc3b..24a681924 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -37,13 +37,13 @@ class DrupalAlterTestCase extends DrupalWebTestCase {
$array_copy = $array;
$array_expected = array('foo' => 'Drupal theme');
drupal_alter('drupal_alter', $array_copy);
- $this->assertEqual($array_copy, $array_expected, t('Single array was altered.'));
+ $this->assertEqual($array_copy, $array_expected, 'Single array was altered.');
$entity_copy = clone $entity;
$entity_expected = clone $entity;
$entity_expected->foo = 'Drupal theme';
drupal_alter('drupal_alter', $entity_copy);
- $this->assertEqual($entity_copy, $entity_expected, t('Single object was altered.'));
+ $this->assertEqual($entity_copy, $entity_expected, 'Single object was altered.');
// Verify alteration of multiple arguments.
$array_copy = $array;
@@ -54,9 +54,9 @@ class DrupalAlterTestCase extends DrupalWebTestCase {
$array2_copy = $array;
$array2_expected = array('foo' => 'Drupal theme');
drupal_alter('drupal_alter', $array_copy, $entity_copy, $array2_copy);
- $this->assertEqual($array_copy, $array_expected, t('First argument to drupal_alter() was altered.'));
- $this->assertEqual($entity_copy, $entity_expected, t('Second argument to drupal_alter() was altered.'));
- $this->assertEqual($array2_copy, $array2_expected, t('Third argument to drupal_alter() was altered.'));
+ $this->assertEqual($array_copy, $array_expected, 'First argument to drupal_alter() was altered.');
+ $this->assertEqual($entity_copy, $entity_expected, 'Second argument to drupal_alter() was altered.');
+ $this->assertEqual($array2_copy, $array2_expected, 'Third argument to drupal_alter() was altered.');
}
}
@@ -83,7 +83,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
$path = "<SCRIPT>alert('XSS')</SCRIPT>";
$link = l($text, $path);
$sanitized_path = check_url(url($path));
- $this->assertTrue(strpos($link, $sanitized_path) !== FALSE, t('XSS attack @path was filtered', array('@path' => $path)));
+ $this->assertTrue(strpos($link, $sanitized_path) !== FALSE, 'XSS attack ' . $path . ' was filtered');
}
/*
@@ -91,7 +91,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
*/
function testLActiveClass() {
$link = l($this->randomName(), $_GET['q']);
- $this->assertTrue($this->hasClass($link, 'active'), t('Class @class is present on link to the current page', array('@class' => 'active')));
+ $this->assertTrue($this->hasClass($link, 'active'), 'Class ' . 'active' . ' is present on link to the current page');
}
/**
@@ -100,8 +100,8 @@ class CommonURLUnitTest extends DrupalWebTestCase {
function testLCustomClass() {
$class = $this->randomName();
$link = l($this->randomName(), $_GET['q'], array('attributes' => array('class' => array($class))));
- $this->assertTrue($this->hasClass($link, $class), t('Custom class @class is present on link when requested', array('@class' => $class)));
- $this->assertTrue($this->hasClass($link, 'active'), t('Class @class is present on link to the current page', array('@class' => 'active')));
+ $this->assertTrue($this->hasClass($link, $class), 'Custom class ' . $class . ' is present on link when requested');
+ $this->assertTrue($this->hasClass($link, 'active'), 'Class ' . 'active' . ' is present on link to the current page');
}
private function hasClass($link, $class) {
@@ -127,42 +127,42 @@ class CommonURLUnitTest extends DrupalWebTestCase {
// Default arguments.
$result = $_GET;
unset($result['q']);
- $this->assertEqual(drupal_get_query_parameters(), $result, t("\$_GET['q'] was removed."));
+ $this->assertEqual(drupal_get_query_parameters(), $result, "\$_GET['q'] was removed.");
// Default exclusion.
$result = $original;
unset($result['q']);
- $this->assertEqual(drupal_get_query_parameters($original), $result, t("'q' was removed."));
+ $this->assertEqual(drupal_get_query_parameters($original), $result, "'q' was removed.");
// First-level exclusion.
$result = $original;
unset($result['b']);
- $this->assertEqual(drupal_get_query_parameters($original, array('b')), $result, t("'b' was removed."));
+ $this->assertEqual(drupal_get_query_parameters($original, array('b')), $result, "'b' was removed.");
// Second-level exclusion.
$result = $original;
unset($result['b']['d']);
- $this->assertEqual(drupal_get_query_parameters($original, array('b[d]')), $result, t("'b[d]' was removed."));
+ $this->assertEqual(drupal_get_query_parameters($original, array('b[d]')), $result, "'b[d]' was removed.");
// Third-level exclusion.
$result = $original;
unset($result['b']['e']['f']);
- $this->assertEqual(drupal_get_query_parameters($original, array('b[e][f]')), $result, t("'b[e][f]' was removed."));
+ $this->assertEqual(drupal_get_query_parameters($original, array('b[e][f]')), $result, "'b[e][f]' was removed.");
// Multiple exclusions.
$result = $original;
unset($result['a'], $result['b']['e'], $result['c']);
- $this->assertEqual(drupal_get_query_parameters($original, array('a', 'b[e]', 'c')), $result, t("'a', 'b[e]', 'c' were removed."));
+ $this->assertEqual(drupal_get_query_parameters($original, array('a', 'b[e]', 'c')), $result, "'a', 'b[e]', 'c' were removed.");
}
/**
* Test drupal_http_build_query().
*/
function testDrupalHttpBuildQuery() {
- $this->assertEqual(drupal_http_build_query(array('a' => ' &#//+%20@۞')), 'a=%20%26%23//%2B%2520%40%DB%9E', t('Value was properly encoded.'));
- $this->assertEqual(drupal_http_build_query(array(' &#//+%20@۞' => 'a')), '%20%26%23%2F%2F%2B%2520%40%DB%9E=a', t('Key was properly encoded.'));
- $this->assertEqual(drupal_http_build_query(array('a' => '1', 'b' => '2', 'c' => '3')), 'a=1&b=2&c=3', t('Multiple values were properly concatenated.'));
- $this->assertEqual(drupal_http_build_query(array('a' => array('b' => '2', 'c' => '3'), 'd' => 'foo')), 'a[b]=2&a[c]=3&d=foo', t('Nested array was properly encoded.'));
+ $this->assertEqual(drupal_http_build_query(array('a' => ' &#//+%20@۞')), 'a=%20%26%23//%2B%2520%40%DB%9E', 'Value was properly encoded.');
+ $this->assertEqual(drupal_http_build_query(array(' &#//+%20@۞' => 'a')), '%20%26%23%2F%2F%2B%2520%40%DB%9E=a', 'Key was properly encoded.');
+ $this->assertEqual(drupal_http_build_query(array('a' => '1', 'b' => '2', 'c' => '3')), 'a=1&b=2&c=3', 'Multiple values were properly concatenated.');
+ $this->assertEqual(drupal_http_build_query(array('a' => array('b' => '2', 'c' => '3'), 'd' => 'foo')), 'a[b]=2&a[c]=3&d=foo', 'Nested array was properly encoded.');
}
/**
@@ -176,7 +176,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
'query' => array('foo' => 'bar', 'bar' => 'baz', 'baz' => ''),
'fragment' => 'foo',
);
- $this->assertEqual(drupal_parse_url($url), $result, t('Relative URL parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, 'Relative URL parsed correctly.');
// Relative URL that is known to confuse parse_url().
$url = 'foo/bar:1';
@@ -185,7 +185,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
'query' => array(),
'fragment' => '',
);
- $this->assertEqual(drupal_parse_url($url), $result, t('Relative URL parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, 'Relative URL parsed correctly.');
// Absolute URL.
$url = '/foo/bar?foo=bar&bar=baz&baz#foo';
@@ -194,13 +194,13 @@ class CommonURLUnitTest extends DrupalWebTestCase {
'query' => array('foo' => 'bar', 'bar' => 'baz', 'baz' => ''),
'fragment' => 'foo',
);
- $this->assertEqual(drupal_parse_url($url), $result, t('Absolute URL parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, 'Absolute URL parsed correctly.');
// External URL testing.
$url = 'http://drupal.org/foo/bar?foo=bar&bar=baz&baz#foo';
// Test that drupal can recognize an absolute URL. Used to prevent attack vectors.
- $this->assertTrue(url_is_external($url), t('Correctly identified an external URL.'));
+ $this->assertTrue(url_is_external($url), 'Correctly identified an external URL.');
// Test the parsing of absolute URLs.
$result = array(
@@ -208,7 +208,7 @@ class CommonURLUnitTest extends DrupalWebTestCase {
'query' => array('foo' => 'bar', 'bar' => 'baz', 'baz' => ''),
'fragment' => 'foo',
);
- $this->assertEqual(drupal_parse_url($url), $result, t('External URL parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, 'External URL parsed correctly.');
// Verify proper parsing of URLs when clean URLs are disabled.
$result = array(
@@ -218,19 +218,19 @@ class CommonURLUnitTest extends DrupalWebTestCase {
);
// Non-clean URLs #1: Absolute URL generated by url().
$url = $GLOBALS['base_url'] . '/?q=foo/bar&bar=baz#foo';
- $this->assertEqual(drupal_parse_url($url), $result, t('Absolute URL with clean URLs disabled parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, 'Absolute URL with clean URLs disabled parsed correctly.');
// Non-clean URLs #2: Relative URL generated by url().
$url = '?q=foo/bar&bar=baz#foo';
- $this->assertEqual(drupal_parse_url($url), $result, t('Relative URL with clean URLs disabled parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, 'Relative URL with clean URLs disabled parsed correctly.');
// Non-clean URLs #3: URL generated by url() on non-Apache webserver.
$url = 'index.php?q=foo/bar&bar=baz#foo';
- $this->assertEqual(drupal_parse_url($url), $result, t('Relative URL on non-Apache webserver with clean URLs disabled parsed correctly.'));
+ $this->assertEqual(drupal_parse_url($url), $result, 'Relative URL on non-Apache webserver with clean URLs disabled parsed correctly.');
// Test that drupal_parse_url() does not allow spoofing a URL to force a malicious redirect.
$parts = drupal_parse_url('forged:http://cwe.mitre.org/data/definitions/601.html');
- $this->assertFalse(valid_url($parts['path'], TRUE), t('drupal_parse_url() correctly parsed a forged URL.'));
+ $this->assertFalse(valid_url($parts['path'], TRUE), 'drupal_parse_url() correctly parsed a forged URL.');
}
/**
@@ -310,30 +310,30 @@ class CommonURLUnitTest extends DrupalWebTestCase {
// Verify external URL can contain a fragment.
$url = $test_url . '#drupal';
$result = url($url);
- $this->assertEqual($url, $result, t('External URL with fragment works without a fragment in $options.'));
+ $this->assertEqual($url, $result, 'External URL with fragment works without a fragment in $options.');
// Verify fragment can be overidden in an external URL.
$url = $test_url . '#drupal';
$fragment = $this->randomName(10);
$result = url($url, array('fragment' => $fragment));
- $this->assertEqual($test_url . '#' . $fragment, $result, t('External URL fragment is overidden with a custom fragment in $options.'));
+ $this->assertEqual($test_url . '#' . $fragment, $result, 'External URL fragment is overidden with a custom fragment in $options.');
// Verify external URL can contain a query string.
$url = $test_url . '?drupal=awesome';
$result = url($url);
- $this->assertEqual($url, $result, t('External URL with query string works without a query string in $options.'));
+ $this->assertEqual($url, $result, 'External URL with query string works without a query string in $options.');
// Verify external URL can be extended with a query string.
$url = $test_url;
$query = array($this->randomName(5) => $this->randomName(5));
$result = url($url, array('query' => $query));
- $this->assertEqual($url . '?' . http_build_query($query, '', '&'), $result, t('External URL can be extended with a query string in $options.'));
+ $this->assertEqual($url . '?' . http_build_query($query, '', '&'), $result, 'External URL can be extended with a query string in $options.');
// Verify query string can be extended in an external URL.
$url = $test_url . '?drupal=awesome';
$query = array($this->randomName(5) => $this->randomName(5));
$result = url($url, array('query' => $query));
- $this->assertEqual($url . '&' . http_build_query($query, '', '&'), $result, t('External URL query string can be extended with a custom query string in $options.'));
+ $this->assertEqual($url . '&' . http_build_query($query, '', '&'), $result, 'External URL query string can be extended with a custom query string in $options.');
}
}
@@ -354,23 +354,23 @@ class CommonXssUnitTest extends DrupalUnitTestCase {
* Check that invalid multi-byte sequences are rejected.
*/
function testInvalidMultiByte() {
- // Ignore PHP 5.3+ invalid multibyte sequence warning.
- $text = @check_plain("Foo\xC0barbaz");
- $this->assertEqual($text, '', 'check_plain() rejects invalid sequence "Foo\xC0barbaz"');
- $text = check_plain("Fooÿñ");
- $this->assertEqual($text, "Fooÿñ", 'check_plain() accepts valid sequence "Fooÿñ"');
- $text = filter_xss("Foo\xC0barbaz");
- $this->assertEqual($text, '', 'filter_xss() rejects invalid sequence "Foo\xC0barbaz"');
- $text = filter_xss("Fooÿñ");
- $this->assertEqual($text, "Fooÿñ", 'filter_xss() accepts valid sequence Fooÿñ');
+ // Ignore PHP 5.3+ invalid multibyte sequence warning.
+ $text = @check_plain("Foo\xC0barbaz");
+ $this->assertEqual($text, '', 'check_plain() rejects invalid sequence "Foo\xC0barbaz"');
+ $text = check_plain("Fooÿñ");
+ $this->assertEqual($text, "Fooÿñ", 'check_plain() accepts valid sequence "Fooÿñ"');
+ $text = filter_xss("Foo\xC0barbaz");
+ $this->assertEqual($text, '', 'filter_xss() rejects invalid sequence "Foo\xC0barbaz"');
+ $text = filter_xss("Fooÿñ");
+ $this->assertEqual($text, "Fooÿñ", 'filter_xss() accepts valid sequence Fooÿñ');
}
/**
* Check that special characters are escaped.
*/
function testEscaping() {
- $text = check_plain("<script>");
- $this->assertEqual($text, '&lt;script&gt;', 'check_plain() escapes &lt;script&gt;');
+ $text = check_plain("<script>");
+ $this->assertEqual($text, '&lt;script&gt;', 'check_plain() escapes &lt;script&gt;');
}
/**
@@ -383,8 +383,8 @@ class CommonXssUnitTest extends DrupalUnitTestCase {
$url = 'javascript:http://www.example.com/?x=1&y=2';
$expected_plain = 'http://www.example.com/?x=1&y=2';
$expected_html = 'http://www.example.com/?x=1&amp;y=2';
- $this->assertIdentical(check_url($url), $expected_html, t('check_url() filters a URL and encodes it for HTML.'));
- $this->assertIdentical(drupal_strip_dangerous_protocols($url), $expected_plain, t('drupal_strip_dangerous_protocols() filters a URL and returns plain text.'));
+ $this->assertIdentical(check_url($url), $expected_html, 'check_url() filters a URL and encodes it for HTML.');
+ $this->assertIdentical(drupal_strip_dangerous_protocols($url), $expected_plain, 'drupal_strip_dangerous_protocols() filters a URL and returns plain text.');
}
}
@@ -533,11 +533,11 @@ class DrupalTagsHandlingTestCase extends DrupalWebTestCase {
$original = $this->validTags;
foreach ($tags as $tag) {
$key = array_search($tag, $original);
- $this->assertTrue($key, t('Make sure tag %tag shows up in the final tags array (originally %original)', array('%tag' => $tag, '%original' => $key)));
+ $this->assertTrue($key, 'Make sure tag ' . $tag . ' shows up in the final tags array (originally ' . $key . ')');
unset($original[$key]);
}
foreach ($original as $leftover) {
- $this->fail(t('Leftover tag %leftover was left over.', array('%leftover' => $leftover)));
+ $this->fail('Leftover tag ' . $leftover . ' was left over.');
}
}
}
@@ -564,7 +564,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
* Check default stylesheets as empty.
*/
function testDefault() {
- $this->assertEqual(array(), drupal_add_css(), t('Default CSS is empty.'));
+ $this->assertEqual(array(), drupal_add_css(), 'Default CSS is empty.');
}
/**
@@ -573,7 +573,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
function testAddFile() {
$path = drupal_get_path('module', 'simpletest') . '/simpletest.css';
$css = drupal_add_css($path);
- $this->assertEqual($css[$path]['data'], $path, t('Adding a CSS file caches it properly.'));
+ $this->assertEqual($css[$path]['data'], $path, 'Adding a CSS file caches it properly.');
}
/**
@@ -582,7 +582,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
function testAddExternal() {
$path = 'http://example.com/style.css';
$css = drupal_add_css($path, 'external');
- $this->assertEqual($css[$path]['type'], 'external', t('Adding an external CSS file caches it properly.'));
+ $this->assertEqual($css[$path]['type'], 'external', 'Adding an external CSS file caches it properly.');
}
/**
@@ -590,7 +590,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
*/
function testReset() {
drupal_static_reset('drupal_add_css');
- $this->assertEqual(array(), drupal_add_css(), t('Resetting the CSS empties the cache.'));
+ $this->assertEqual(array(), drupal_add_css(), 'Resetting the CSS empties the cache.');
}
/**
@@ -600,7 +600,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$css = drupal_get_path('module', 'simpletest') . '/simpletest.css';
drupal_add_css($css);
$styles = drupal_get_css();
- $this->assertTrue(strpos($styles, $css) > 0, t('Rendered CSS includes the added stylesheet.'));
+ $this->assertTrue(strpos($styles, $css) > 0, 'Rendered CSS includes the added stylesheet.');
}
/**
@@ -612,7 +612,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$styles = drupal_get_css();
// Stylesheet URL may be the href of a LINK tag or in an @import statement
// of a STYLE tag.
- $this->assertTrue(strpos($styles, 'href="' . $css) > 0 || strpos($styles, '@import url("' . $css . '")') > 0, t('Rendering an external CSS file.'));
+ $this->assertTrue(strpos($styles, 'href="' . $css) > 0 || strpos($styles, '@import url("' . $css . '")') > 0, 'Rendering an external CSS file.');
}
/**
@@ -623,7 +623,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$css_preprocessed = '<style type="text/css" media="all">' . drupal_load_stylesheet_content($css, TRUE) . '</style>';
drupal_add_css($css, array('type' => 'inline', 'preprocess' => TRUE));
$styles = drupal_get_css();
- $this->assertEqual(trim($styles), $css_preprocessed, t('Rendering preprocessed inline CSS adds it to the page.'));
+ $this->assertEqual(trim($styles), $css_preprocessed, 'Rendering preprocessed inline CSS adds it to the page.');
}
/**
@@ -633,7 +633,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$css = 'body { padding: 0px; }';
drupal_add_css($css, array('type' => 'inline'));
$styles = drupal_get_css();
- $this->assertTrue(strpos($styles, $css) > 0, t('Rendering non-preprocessed inline CSS adds it to the page.'));
+ $this->assertTrue(strpos($styles, $css) > 0, 'Rendering non-preprocessed inline CSS adds it to the page.');
}
/**
@@ -661,7 +661,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
// Fetch the page.
$this->drupalGet('node/' . $node->nid);
- $this->assertRaw($expected, t('Inline stylesheets appear in the full page rendering.'));
+ $this->assertRaw($expected, 'Inline stylesheets appear in the full page rendering.');
}
/**
@@ -694,7 +694,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$result = array();
}
- $this->assertIdentical($result, $expected, t('The CSS files are in the expected order.'));
+ $this->assertIdentical($result, $expected, 'The CSS files are in the expected order.');
}
/**
@@ -706,16 +706,16 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
// The dummy stylesheet should be the only one included.
$styles = drupal_get_css();
- $this->assert(strpos($styles, drupal_get_path('module', 'simpletest') . '/tests/system.css') !== FALSE, t('The overriding CSS file is output.'));
- $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system.css') === FALSE, t('The overriden CSS file is not output.'));
+ $this->assert(strpos($styles, drupal_get_path('module', 'simpletest') . '/tests/system.css') !== FALSE, 'The overriding CSS file is output.');
+ $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system.css') === FALSE, 'The overriden CSS file is not output.');
drupal_add_css(drupal_get_path('module', 'simpletest') . '/tests/system.css');
drupal_add_css(drupal_get_path('module', 'system') . '/system.css');
// The standard stylesheet should be the only one included.
$styles = drupal_get_css();
- $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system.css') !== FALSE, t('The overriding CSS file is output.'));
- $this->assert(strpos($styles, drupal_get_path('module', 'simpletest') . '/tests/system.css') === FALSE, t('The overriden CSS file is not output.'));
+ $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system.css') !== FALSE, 'The overriding CSS file is output.');
+ $this->assert(strpos($styles, drupal_get_path('module', 'simpletest') . '/tests/system.css') === FALSE, 'The overriden CSS file is not output.');
}
/**
@@ -729,7 +729,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
// Check to see if system-rtl.css was also added.
$styles = drupal_get_css();
- $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system-rtl.css') !== FALSE, t('CSS is alterable as right to left overrides are added.'));
+ $this->assert(strpos($styles, drupal_get_path('module', 'system') . '/system-rtl.css') !== FALSE, 'CSS is alterable as right to left overrides are added.');
// Change the language back to left to right.
$language->direction = LANGUAGE_LTR;
@@ -742,7 +742,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
function testAddCssFileWithQueryString() {
$this->drupalGet('common-test/query-string');
$query_string = substr(variable_get('css_js_query_string', '0'), 0, 1);
- $this->assertRaw(drupal_get_path('module', 'node') . '/node.css?arg1=value1&amp;arg2=value2&amp;' . $query_string, t('Query string was appended correctly to css.'));
+ $this->assertRaw(drupal_get_path('module', 'node') . '/node.css?arg1=value1&amp;arg2=value2&amp;' . $query_string, 'Query string was appended correctly to css.');
}
}
@@ -764,14 +764,14 @@ class DrupalHTMLIdentifierTestCase extends DrupalUnitTestCase {
function testDrupalCleanCSSIdentifier() {
// Verify that no valid ASCII characters are stripped from the identifier.
$identifier = 'abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789';
- $this->assertIdentical(drupal_clean_css_identifier($identifier, array()), $identifier, t('Verify valid ASCII characters pass through.'));
+ $this->assertIdentical(drupal_clean_css_identifier($identifier, array()), $identifier, 'Verify valid ASCII characters pass through.');
// Verify that valid UTF-8 characters are not stripped from the identifier.
$identifier = '¡¢£¤¥';
- $this->assertIdentical(drupal_clean_css_identifier($identifier, array()), $identifier, t('Verify valid UTF-8 characters pass through.'));
+ $this->assertIdentical(drupal_clean_css_identifier($identifier, array()), $identifier, 'Verify valid UTF-8 characters pass through.');
// Verify that invalid characters (including non-breaking space) are stripped from the identifier.
- $this->assertIdentical(drupal_clean_css_identifier('invalid !"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ identifier', array()), 'invalididentifier', t('Strip invalid characters.'));
+ $this->assertIdentical(drupal_clean_css_identifier('invalid !"#$%&\'()*+,./:;<=>?@[\\]^`{|}~ identifier', array()), 'invalididentifier', 'Strip invalid characters.');
}
/**
@@ -779,7 +779,7 @@ class DrupalHTMLIdentifierTestCase extends DrupalUnitTestCase {
*/
function testDrupalHTMLClass() {
// Verify Drupal coding standards are enforced.
- $this->assertIdentical(drupal_html_class('CLASS NAME_[Ü]'), 'class-name--ü', t('Enforce Drupal coding standards.'));
+ $this->assertIdentical(drupal_html_class('CLASS NAME_[Ü]'), 'class-name--ü', 'Enforce Drupal coding standards.');
}
/**
@@ -788,21 +788,21 @@ class DrupalHTMLIdentifierTestCase extends DrupalUnitTestCase {
function testDrupalHTMLId() {
// Verify that letters, digits, and hyphens are not stripped from the ID.
$id = 'abcdefghijklmnopqrstuvwxyz-0123456789';
- $this->assertIdentical(drupal_html_id($id), $id, t('Verify valid characters pass through.'));
+ $this->assertIdentical(drupal_html_id($id), $id, 'Verify valid characters pass through.');
// Verify that invalid characters are stripped from the ID.
- $this->assertIdentical(drupal_html_id('invalid,./:@\\^`{Üidentifier'), 'invalididentifier', t('Strip invalid characters.'));
+ $this->assertIdentical(drupal_html_id('invalid,./:@\\^`{Üidentifier'), 'invalididentifier', 'Strip invalid characters.');
// Verify Drupal coding standards are enforced.
- $this->assertIdentical(drupal_html_id('ID NAME_[1]'), 'id-name-1', t('Enforce Drupal coding standards.'));
+ $this->assertIdentical(drupal_html_id('ID NAME_[1]'), 'id-name-1', 'Enforce Drupal coding standards.');
// Reset the static cache so we can ensure the unique id count is at zero.
drupal_static_reset('drupal_html_id');
// Clean up IDs with invalid starting characters.
- $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id', t('Test the uniqueness of IDs #1.'));
- $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id--2', t('Test the uniqueness of IDs #2.'));
- $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id--3', t('Test the uniqueness of IDs #3.'));
+ $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id', 'Test the uniqueness of IDs #1.');
+ $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id--2', 'Test the uniqueness of IDs #2.');
+ $this->assertIdentical(drupal_html_id('test-unique-id'), 'test-unique-id--3', 'Test the uniqueness of IDs #3.');
}
}
@@ -841,11 +841,11 @@ class CascadingStylesheetsUnitTest extends DrupalUnitTestCase {
foreach ($testfiles as $file) {
$expected = file_get_contents("$path/$file.unoptimized.css");
$unoptimized_output = drupal_load_stylesheet("$path/$file.unoptimized.css", FALSE);
- $this->assertEqual($unoptimized_output, $expected, t('Unoptimized CSS file has expected contents (@file)', array('@file' => $file)));
+ $this->assertEqual($unoptimized_output, $expected, 'Unoptimized CSS file has expected contents (' . $file . ')');
$expected = file_get_contents("$path/$file.optimized.css");
$optimized_output = drupal_load_stylesheet("$path/$file", TRUE);
- $this->assertEqual($optimized_output, $expected, t('Optimized CSS file has expected contents (@file)', array('@file' => $file)));
+ $this->assertEqual($optimized_output, $expected, 'Optimized CSS file has expected contents (' . $file . ')');
}
}
}
@@ -871,24 +871,24 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
// Parse URL schema.
$missing_scheme = drupal_http_request('example.com/path');
- $this->assertEqual($missing_scheme->code, -1002, t('Returned with "-1002" error code.'));
- $this->assertEqual($missing_scheme->error, 'missing schema', t('Returned with "missing schema" error message.'));
+ $this->assertEqual($missing_scheme->code, -1002, 'Returned with "-1002" error code.');
+ $this->assertEqual($missing_scheme->error, 'missing schema', 'Returned with "missing schema" error message.');
$unable_to_parse = drupal_http_request('http:///path');
- $this->assertEqual($unable_to_parse->code, -1001, t('Returned with "-1001" error code.'));
- $this->assertEqual($unable_to_parse->error, 'unable to parse URL', t('Returned with "unable to parse URL" error message.'));
+ $this->assertEqual($unable_to_parse->code, -1001, 'Returned with "-1001" error code.');
+ $this->assertEqual($unable_to_parse->error, 'unable to parse URL', 'Returned with "unable to parse URL" error message.');
// Fetch page.
$result = drupal_http_request(url('node', array('absolute' => TRUE)));
- $this->assertEqual($result->code, 200, t('Fetched page successfully.'));
+ $this->assertEqual($result->code, 200, 'Fetched page successfully.');
$this->drupalSetContent($result->data);
- $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), t('Site title matches.'));
+ $this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), 'Site title matches.');
// Test that code and status message is returned.
$result = drupal_http_request(url('pagedoesnotexist', array('absolute' => TRUE)));
- $this->assertTrue(!empty($result->protocol), t('Result protocol is returned.'));
- $this->assertEqual($result->code, '404', t('Result code is 404'));
- $this->assertEqual($result->status_message, 'Not Found', t('Result status message is "Not Found"'));
+ $this->assertTrue(!empty($result->protocol), 'Result protocol is returned.');
+ $this->assertEqual($result->code, '404', 'Result code is 404');
+ $this->assertEqual($result->status_message, 'Not Found', 'Result status message is "Not Found"');
// Skip the timeout tests when the testing environment is HTTPS because
// stream_set_timeout() does not work for SSL connections.
@@ -903,9 +903,9 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
timer_start(__METHOD__);
$result = drupal_http_request(url('system-test/sleep/10', array('absolute' => TRUE)), array('timeout' => 2));
$time = timer_read(__METHOD__) / 1000;
- $this->assertTrue(1.8 < $time && $time < 5, t('Request timed out (%time seconds).', array('%time' => $time)));
- $this->assertTrue($result->error, t('An error message was returned.'));
- $this->assertEqual($result->code, HTTP_REQUEST_TIMEOUT, t('Proper error code was returned.'));
+ $this->assertTrue(1.8 < $time && $time < 5, 'Request timed out (' . $time . ' seconds).');
+ $this->assertTrue($result->error, 'An error message was returned.');
+ $this->assertEqual($result->code, HTTP_REQUEST_TIMEOUT, 'Proper error code was returned.');
}
}
@@ -918,40 +918,40 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
$result = drupal_http_request($auth);
$this->drupalSetContent($result->data);
- $this->assertRaw($username, t('$_SERVER["PHP_AUTH_USER"] is passed correctly.'));
- $this->assertRaw($password, t('$_SERVER["PHP_AUTH_PW"] is passed correctly.'));
+ $this->assertRaw($username, '$_SERVER["PHP_AUTH_USER"] is passed correctly.');
+ $this->assertRaw($password, '$_SERVER["PHP_AUTH_PW"] is passed correctly.');
}
function testDrupalHTTPRequestRedirect() {
$redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_301->redirect_code, 301, t('drupal_http_request follows the 301 redirect.'));
+ $this->assertEqual($redirect_301->redirect_code, 301, 'drupal_http_request follows the 301 redirect.');
$redirect_301 = drupal_http_request(url('system-test/redirect/301', array('absolute' => TRUE)), array('max_redirects' => 0));
- $this->assertFalse(isset($redirect_301->redirect_code), t('drupal_http_request does not follow 301 redirect if max_redirects = 0.'));
+ $this->assertFalse(isset($redirect_301->redirect_code), 'drupal_http_request does not follow 301 redirect if max_redirects = 0.');
$redirect_invalid = drupal_http_request(url('system-test/redirect-noscheme', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_invalid->code, -1002, t('301 redirect to invalid URL returned with error code !error.', array('!error' => $redirect_invalid->error)));
- $this->assertEqual($redirect_invalid->error, 'missing schema', t('301 redirect to invalid URL returned with error message "!error".', array('!error' => $redirect_invalid->error)));
+ $this->assertEqual($redirect_invalid->code, -1002, '301 redirect to invalid URL returned with error code ' . $redirect_invalid->error . '.');
+ $this->assertEqual($redirect_invalid->error, 'missing schema', '301 redirect to invalid URL returned with error message "' . $redirect_invalid->error . '".');
$redirect_invalid = drupal_http_request(url('system-test/redirect-noparse', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_invalid->code, -1001, t('301 redirect to invalid URL returned with error message code "!error".', array('!error' => $redirect_invalid->error)));
- $this->assertEqual($redirect_invalid->error, 'unable to parse URL', t('301 redirect to invalid URL returned with error message "!error".', array('!error' => $redirect_invalid->error)));
+ $this->assertEqual($redirect_invalid->code, -1001, '301 redirect to invalid URL returned with error message code "' . $redirect_invalid->error . '".');
+ $this->assertEqual($redirect_invalid->error, 'unable to parse URL', '301 redirect to invalid URL returned with error message "' . $redirect_invalid->error . '".');
$redirect_invalid = drupal_http_request(url('system-test/redirect-invalid-scheme', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_invalid->code, -1003, t('301 redirect to invalid URL returned with error code !error.', array('!error' => $redirect_invalid->error)));
- $this->assertEqual($redirect_invalid->error, 'invalid schema ftp', t('301 redirect to invalid URL returned with error message "!error".', array('!error' => $redirect_invalid->error)));
+ $this->assertEqual($redirect_invalid->code, -1003, '301 redirect to invalid URL returned with error code ' . $redirect_invalid->error . '.');
+ $this->assertEqual($redirect_invalid->error, 'invalid schema ftp', '301 redirect to invalid URL returned with error message "' . $redirect_invalid->error . '".');
$redirect_302 = drupal_http_request(url('system-test/redirect/302', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_302->redirect_code, 302, t('drupal_http_request follows the 302 redirect.'));
+ $this->assertEqual($redirect_302->redirect_code, 302, 'drupal_http_request follows the 302 redirect.');
$redirect_302 = drupal_http_request(url('system-test/redirect/302', array('absolute' => TRUE)), array('max_redirects' => 0));
- $this->assertFalse(isset($redirect_302->redirect_code), t('drupal_http_request does not follow 302 redirect if $retry = 0.'));
+ $this->assertFalse(isset($redirect_302->redirect_code), 'drupal_http_request does not follow 302 redirect if $retry = 0.');
$redirect_307 = drupal_http_request(url('system-test/redirect/307', array('absolute' => TRUE)), array('max_redirects' => 1));
- $this->assertEqual($redirect_307->redirect_code, 307, t('drupal_http_request follows the 307 redirect.'));
+ $this->assertEqual($redirect_307->redirect_code, 307, 'drupal_http_request follows the 307 redirect.');
$redirect_307 = drupal_http_request(url('system-test/redirect/307', array('absolute' => TRUE)), array('max_redirects' => 0));
- $this->assertFalse(isset($redirect_307->redirect_code), t('drupal_http_request does not follow 307 redirect if max_redirects = 0.'));
+ $this->assertFalse(isset($redirect_307->redirect_code), 'drupal_http_request does not follow 307 redirect if max_redirects = 0.');
}
}
@@ -990,13 +990,13 @@ class DrupalSetContentTestCase extends DrupalWebTestCase {
// Ensure drupal_get_region_content returns expected results when fetching all regions.
$content = drupal_get_region_content(NULL, $delimiter);
foreach ($content as $region => $region_content) {
- $this->assertEqual($region_content, $values[$region], t('@region region text verified when fetching all regions', array('@region' => $region)));
+ $this->assertEqual($region_content, $values[$region], $region . ' region text verified when fetching all regions');
}
// Ensure drupal_get_region_content returns expected results when fetching a single region.
foreach ($block_regions as $region) {
$region_content = drupal_get_region_content($region, $delimiter);
- $this->assertEqual($region_content, $values[$region], t('@region region text verified when fetching single region.', array('@region' => $region)));
+ $this->assertEqual($region_content, $values[$region], $region . ' region text verified when fetching single region.');
}
}
}
@@ -1024,23 +1024,23 @@ class DrupalGotoTest extends DrupalWebTestCase {
$this->drupalGet('common-test/drupal_goto/redirect');
$headers = $this->drupalGetHeaders(TRUE);
list(, $status) = explode(' ', $headers[0][':status'], 3);
- $this->assertEqual($status, 302, t('Expected response code was sent.'));
- $this->assertText('drupal_goto', t('Drupal goto redirect succeeded.'));
- $this->assertEqual($this->getUrl(), url('common-test/drupal_goto', array('absolute' => TRUE)), t('Drupal goto redirected to expected URL.'));
+ $this->assertEqual($status, 302, 'Expected response code was sent.');
+ $this->assertText('drupal_goto', 'Drupal goto redirect succeeded.');
+ $this->assertEqual($this->getUrl(), url('common-test/drupal_goto', array('absolute' => TRUE)), 'Drupal goto redirected to expected URL.');
$this->drupalGet('common-test/drupal_goto/redirect_advanced');
$headers = $this->drupalGetHeaders(TRUE);
list(, $status) = explode(' ', $headers[0][':status'], 3);
- $this->assertEqual($status, 301, t('Expected response code was sent.'));
- $this->assertText('drupal_goto', t('Drupal goto redirect succeeded.'));
- $this->assertEqual($this->getUrl(), url('common-test/drupal_goto', array('query' => array('foo' => '123'), 'absolute' => TRUE)), t('Drupal goto redirected to expected URL.'));
+ $this->assertEqual($status, 301, 'Expected response code was sent.');
+ $this->assertText('drupal_goto', 'Drupal goto redirect succeeded.');
+ $this->assertEqual($this->getUrl(), url('common-test/drupal_goto', array('query' => array('foo' => '123'), 'absolute' => TRUE)), 'Drupal goto redirected to expected URL.');
// Test that drupal_goto() respects ?destination=xxx. Use an complicated URL
// to test that the path is encoded and decoded properly.
$destination = 'common-test/drupal_goto/destination?foo=%2525&bar=123';
$this->drupalGet('common-test/drupal_goto/redirect', array('query' => array('destination' => $destination)));
- $this->assertText('drupal_goto', t('Drupal goto redirect with destination succeeded.'));
- $this->assertEqual($this->getUrl(), url('common-test/drupal_goto/destination', array('query' => array('foo' => '%25', 'bar' => '123'), 'absolute' => TRUE)), t('Drupal goto redirected to given query string destination. '));
+ $this->assertText('drupal_goto', 'Drupal goto redirect with destination succeeded.');
+ $this->assertEqual($this->getUrl(), url('common-test/drupal_goto/destination', array('query' => array('foo' => '%25', 'bar' => '123'), 'absolute' => TRUE)), 'Drupal goto redirected to given query string destination. ');
}
/**
@@ -1049,8 +1049,8 @@ class DrupalGotoTest extends DrupalWebTestCase {
function testDrupalGotoAlter() {
$this->drupalGet('common-test/drupal_goto/redirect_fail');
- $this->assertNoText(t("Drupal goto failed to stop program"), t("Drupal goto stopped program."));
- $this->assertNoText('drupal_goto_fail', t("Drupal goto redirect failed."));
+ $this->assertNoText(t("Drupal goto failed to stop program"), "Drupal goto stopped program.");
+ $this->assertNoText('drupal_goto_fail', "Drupal goto redirect failed.");
}
/**
@@ -1061,12 +1061,12 @@ class DrupalGotoTest extends DrupalWebTestCase {
// Verify that a 'destination' query string is used as destination.
$this->drupalGet('common-test/destination', array('query' => array('destination' => $query)));
- $this->assertText('The destination: ' . $query, t('The given query string destination is determined as destination.'));
+ $this->assertText('The destination: ' . $query, 'The given query string destination is determined as destination.');
// Verify that the current path is used as destination.
$this->drupalGet('common-test/destination', array('query' => array($query => NULL)));
$url = 'common-test/destination?' . $query;
- $this->assertText('The destination: ' . $url, t('The current path is determined as destination.'));
+ $this->assertText('The destination: ' . $url, 'The current path is determined as destination.');
}
}
@@ -1110,7 +1110,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
* Test default JavaScript is empty.
*/
function testDefault() {
- $this->assertEqual(array(), drupal_add_js(), t('Default JavaScript is empty.'));
+ $this->assertEqual(array(), drupal_add_js(), 'Default JavaScript is empty.');
}
/**
@@ -1118,10 +1118,10 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testAddFile() {
$javascript = drupal_add_js('misc/collapse.js');
- $this->assertTrue(array_key_exists('misc/jquery.js', $javascript), t('jQuery is added when a file is added.'));
- $this->assertTrue(array_key_exists('misc/drupal.js', $javascript), t('Drupal.js is added when file is added.'));
- $this->assertTrue(array_key_exists('misc/collapse.js', $javascript), t('JavaScript files are correctly added.'));
- $this->assertEqual(base_path(), $javascript['settings']['data'][0]['basePath'], t('Base path JavaScript setting is correctly set.'));
+ $this->assertTrue(array_key_exists('misc/jquery.js', $javascript), 'jQuery is added when a file is added.');
+ $this->assertTrue(array_key_exists('misc/drupal.js', $javascript), 'Drupal.js is added when file is added.');
+ $this->assertTrue(array_key_exists('misc/collapse.js', $javascript), 'JavaScript files are correctly added.');
+ $this->assertEqual(base_path(), $javascript['settings']['data'][0]['basePath'], 'Base path JavaScript setting is correctly set.');
}
/**
@@ -1129,8 +1129,8 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testAddSetting() {
$javascript = drupal_add_js(array('drupal' => 'rocks', 'dries' => 280342800), 'setting');
- $this->assertEqual(280342800, $javascript['settings']['data'][1]['dries'], t('JavaScript setting is set correctly.'));
- $this->assertEqual('rocks', $javascript['settings']['data'][1]['drupal'], t('The other JavaScript setting is set correctly.'));
+ $this->assertEqual(280342800, $javascript['settings']['data'][1]['dries'], 'JavaScript setting is set correctly.');
+ $this->assertEqual('rocks', $javascript['settings']['data'][1]['drupal'], 'The other JavaScript setting is set correctly.');
}
/**
@@ -1139,7 +1139,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testAddExternal() {
$path = 'http://example.com/script.js';
$javascript = drupal_add_js($path, 'external');
- $this->assertTrue(array_key_exists('http://example.com/script.js', $javascript), t('Added an external JavaScript file.'));
+ $this->assertTrue(array_key_exists('http://example.com/script.js', $javascript), 'Added an external JavaScript file.');
}
/**
@@ -1148,9 +1148,9 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testHeaderSetting() {
drupal_add_js(array('testSetting' => 'testValue'), 'setting');
$javascript = drupal_get_js('header');
- $this->assertTrue(strpos($javascript, 'basePath') > 0, t('Rendered JavaScript header returns basePath setting.'));
- $this->assertTrue(strpos($javascript, 'testSetting') > 0, t('Rendered JavaScript header returns custom setting.'));
- $this->assertTrue(strpos($javascript, 'misc/jquery.js') > 0, t('Rendered JavaScript header includes jQuery.'));
+ $this->assertTrue(strpos($javascript, 'basePath') > 0, 'Rendered JavaScript header returns basePath setting.');
+ $this->assertTrue(strpos($javascript, 'testSetting') > 0, 'Rendered JavaScript header returns custom setting.');
+ $this->assertTrue(strpos($javascript, 'misc/jquery.js') > 0, 'Rendered JavaScript header includes jQuery.');
}
/**
@@ -1159,7 +1159,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testReset() {
drupal_add_js('misc/collapse.js');
drupal_static_reset('drupal_add_js');
- $this->assertEqual(array(), drupal_add_js(), t('Resetting the JavaScript correctly empties the cache.'));
+ $this->assertEqual(array(), drupal_add_js(), 'Resetting the JavaScript correctly empties the cache.');
}
/**
@@ -1168,9 +1168,9 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testAddInline() {
$inline = 'jQuery(function () { });';
$javascript = drupal_add_js($inline, array('type' => 'inline', 'scope' => 'footer'));
- $this->assertTrue(array_key_exists('misc/jquery.js', $javascript), t('jQuery is added when inline scripts are added.'));
+ $this->assertTrue(array_key_exists('misc/jquery.js', $javascript), 'jQuery is added when inline scripts are added.');
$data = end($javascript);
- $this->assertEqual($inline, $data['data'], t('Inline JavaScript is correctly added to the footer.'));
+ $this->assertEqual($inline, $data['data'], 'Inline JavaScript is correctly added to the footer.');
}
/**
@@ -1181,7 +1181,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
drupal_add_js($external, 'external');
$javascript = drupal_get_js();
// Local files have a base_path() prefix, external files should not.
- $this->assertTrue(strpos($javascript, 'src="' . $external) > 0, t('Rendering an external JavaScript file.'));
+ $this->assertTrue(strpos($javascript, 'src="' . $external) > 0, 'Rendering an external JavaScript file.');
}
/**
@@ -1191,7 +1191,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
$inline = 'jQuery(function () { });';
drupal_add_js($inline, array('type' => 'inline', 'scope' => 'footer'));
$javascript = drupal_get_js('footer');
- $this->assertTrue(strpos($javascript, $inline) > 0, t('Rendered JavaScript footer returns the inline code.'));
+ $this->assertTrue(strpos($javascript, $inline) > 0, 'Rendered JavaScript footer returns the inline code.');
}
/**
@@ -1199,7 +1199,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testNoCache() {
$javascript = drupal_add_js('misc/collapse.js', array('cache' => FALSE));
- $this->assertFalse($javascript['misc/collapse.js']['preprocess'], t('Setting cache to FALSE sets proprocess to FALSE when adding JavaScript.'));
+ $this->assertFalse($javascript['misc/collapse.js']['preprocess'], 'Setting cache to FALSE sets proprocess to FALSE when adding JavaScript.');
}
/**
@@ -1207,7 +1207,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testDifferentWeight() {
$javascript = drupal_add_js('misc/collapse.js', array('weight' => JS_THEME));
- $this->assertEqual($javascript['misc/collapse.js']['weight'], JS_THEME, t('Adding a JavaScript file with a different weight caches the given weight.'));
+ $this->assertEqual($javascript['misc/collapse.js']['weight'], JS_THEME, 'Adding a JavaScript file with a different weight caches the given weight.');
}
/**
@@ -1249,7 +1249,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
else {
$result = array();
}
- $this->assertIdentical($result, $expected, t('JavaScript is added in the expected weight order.'));
+ $this->assertIdentical($result, $expected, 'JavaScript is added in the expected weight order.');
}
/**
@@ -1258,7 +1258,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testRenderDifferentWeight() {
drupal_add_js('misc/collapse.js', array('weight' => JS_LIBRARY - 21));
$javascript = drupal_get_js();
- $this->assertTrue(strpos($javascript, 'misc/collapse.js') < strpos($javascript, 'misc/jquery.js'), t('Rendering a JavaScript file above jQuery.'));
+ $this->assertTrue(strpos($javascript, 'misc/collapse.js') < strpos($javascript, 'misc/jquery.js'), 'Rendering a JavaScript file above jQuery.');
}
/**
@@ -1275,7 +1275,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
// tableselect.js. See simpletest_js_alter() to see where this alteration
// takes place.
$javascript = drupal_get_js();
- $this->assertTrue(strpos($javascript, 'simpletest.js') < strpos($javascript, 'misc/tableselect.js'), t('Altering JavaScript weight through the alter hook.'));
+ $this->assertTrue(strpos($javascript, 'simpletest.js') < strpos($javascript, 'misc/tableselect.js'), 'Altering JavaScript weight through the alter hook.');
}
/**
@@ -1283,11 +1283,11 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testLibraryRender() {
$result = drupal_add_library('system', 'farbtastic');
- $this->assertTrue($result !== FALSE, t('Library was added without errors.'));
+ $this->assertTrue($result !== FALSE, 'Library was added without errors.');
$scripts = drupal_get_js();
$styles = drupal_get_css();
- $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), t('JavaScript of library was added to the page.'));
- $this->assertTrue(strpos($styles, 'misc/farbtastic/farbtastic.css'), t('Stylesheet of library was added to the page.'));
+ $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), 'JavaScript of library was added to the page.');
+ $this->assertTrue(strpos($styles, 'misc/farbtastic/farbtastic.css'), 'Stylesheet of library was added to the page.');
}
/**
@@ -1298,12 +1298,12 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testLibraryAlter() {
// Verify that common_test altered the title of Farbtastic.
$library = drupal_get_library('system', 'farbtastic');
- $this->assertEqual($library['title'], 'Farbtastic: Altered Library', t('Registered libraries were altered.'));
+ $this->assertEqual($library['title'], 'Farbtastic: Altered Library', 'Registered libraries were altered.');
// common_test_library_alter() also added a dependency on jQuery Form.
drupal_add_library('system', 'farbtastic');
$scripts = drupal_get_js();
- $this->assertTrue(strpos($scripts, 'misc/jquery.form.js'), t('Altered library dependencies are added to the page.'));
+ $this->assertTrue(strpos($scripts, 'misc/jquery.form.js'), 'Altered library dependencies are added to the page.');
}
/**
@@ -1313,7 +1313,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testLibraryNameConflicts() {
$farbtastic = drupal_get_library('common_test', 'farbtastic');
- $this->assertEqual($farbtastic['title'], 'Custom Farbtastic Library', t('Alternative libraries can be added to the page.'));
+ $this->assertEqual($farbtastic['title'], 'Custom Farbtastic Library', 'Alternative libraries can be added to the page.');
}
/**
@@ -1321,13 +1321,13 @@ class JavaScriptTestCase extends DrupalWebTestCase {
*/
function testLibraryUnknown() {
$result = drupal_get_library('unknown', 'unknown');
- $this->assertFalse($result, t('Unknown library returned FALSE.'));
+ $this->assertFalse($result, 'Unknown library returned FALSE.');
drupal_static_reset('drupal_get_library');
$result = drupal_add_library('unknown', 'unknown');
- $this->assertFalse($result, t('Unknown library returned FALSE.'));
+ $this->assertFalse($result, 'Unknown library returned FALSE.');
$scripts = drupal_get_js();
- $this->assertTrue(strpos($scripts, 'unknown') === FALSE, t('Unknown library was not added to the page.'));
+ $this->assertTrue(strpos($scripts, 'unknown') === FALSE, 'Unknown library was not added to the page.');
}
/**
@@ -1337,7 +1337,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
$element['#attached']['library'][] = array('system', 'farbtastic');
drupal_render($element);
$scripts = drupal_get_js();
- $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), t('The attached_library property adds the additional libraries.'));
+ $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), 'The attached_library property adds the additional libraries.');
}
/**
@@ -1347,7 +1347,7 @@ class JavaScriptTestCase extends DrupalWebTestCase {
function testAddJsFileWithQueryString() {
$this->drupalGet('common-test/query-string');
$query_string = substr(variable_get('css_js_query_string', '0'), 0, 1);
- $this->assertRaw(drupal_get_path('module', 'node') . '/node.js?arg1=value1&amp;arg2=value2&amp;' . $query_string, t('Query string was appended correctly to js.'));
+ $this->assertRaw(drupal_get_path('module', 'node') . '/node.js?arg1=value1&amp;arg2=value2&amp;' . $query_string, 'Query string was appended correctly to js.');
}
}
@@ -1387,17 +1387,17 @@ class DrupalRenderUnitTestCase extends DrupalWebTestCase {
$output = drupal_render($elements);
// The lowest weight element should appear last in $output.
- $this->assertTrue(strpos($output, $second) > strpos($output, $first), t('Elements were sorted correctly by weight.'));
+ $this->assertTrue(strpos($output, $second) > strpos($output, $first), 'Elements were sorted correctly by weight.');
// Confirm that the $elements array has '#sorted' set to TRUE.
- $this->assertTrue($elements['#sorted'], t("'#sorted' => TRUE was added to the array"));
+ $this->assertTrue($elements['#sorted'], "'#sorted' => TRUE was added to the array");
// Pass $elements through element_children() and ensure it remains
// sorted in the correct order. drupal_render() will return an empty string
// if used on the same array in the same request.
$children = element_children($elements);
- $this->assertTrue(array_shift($children) == 'first', t('Child found in the correct order.'));
- $this->assertTrue(array_shift($children) == 'second', t('Child found in the correct order.'));
+ $this->assertTrue(array_shift($children) == 'first', 'Child found in the correct order.');
+ $this->assertTrue(array_shift($children) == 'second', 'Child found in the correct order.');
// The same array structure again, but with #sorted set to TRUE.
@@ -1415,7 +1415,7 @@ class DrupalRenderUnitTestCase extends DrupalWebTestCase {
$output = drupal_render($elements);
// The elements should appear in output in the same order as the array.
- $this->assertTrue(strpos($output, $second) < strpos($output, $first), t('Elements were not sorted.'));
+ $this->assertTrue(strpos($output, $second) < strpos($output, $first), 'Elements were not sorted.');
}
/**
@@ -1479,7 +1479,7 @@ class ValidUrlTestCase extends DrupalUnitTestCase {
foreach ($valid_absolute_urls as $url) {
$test_url = $scheme . '://' . $url;
$valid_url = valid_url($test_url, TRUE);
- $this->assertTrue($valid_url, t('@url is a valid url.', array('@url' => $test_url)));
+ $this->assertTrue($valid_url, $test_url . ' is a valid url.');
}
}
}
@@ -1499,7 +1499,7 @@ class ValidUrlTestCase extends DrupalUnitTestCase {
foreach ($invalid_ablosule_urls as $url) {
$test_url = $scheme . '://' . $url;
$valid_url = valid_url($test_url, TRUE);
- $this->assertFalse($valid_url, t('@url is NOT a valid url.', array('@url' => $test_url)));
+ $this->assertFalse($valid_url, $test_url . ' is NOT a valid url.');
}
}
}
@@ -1520,7 +1520,7 @@ class ValidUrlTestCase extends DrupalUnitTestCase {
foreach ($valid_relative_urls as $url) {
$test_url = $front . $url;
$valid_url = valid_url($test_url);
- $this->assertTrue($valid_url, t('@url is a valid url.', array('@url' => $test_url)));
+ $this->assertTrue($valid_url, $test_url . ' is a valid url.');
}
}
}
@@ -1539,7 +1539,7 @@ class ValidUrlTestCase extends DrupalUnitTestCase {
foreach ($invalid_relative_urls as $url) {
$test_url = $front . $url;
$valid_url = valid_url($test_url);
- $this->assertFALSE($valid_url, t('@url is NOT a valid url.', array('@url' => $test_url)));
+ $this->assertFALSE($valid_url, $test_url . ' is NOT a valid url.');
}
}
}
@@ -1570,30 +1570,30 @@ class DrupalDataApiTest extends DrupalWebTestCase {
$person->name = 'John';
$person->unknown_column = 123;
$insert_result = drupal_write_record('test', $person);
- $this->assertTrue($insert_result == SAVED_NEW, t('Correct value returned when a record is inserted with drupal_write_record() for a table with a single-field primary key.'));
- $this->assertTrue(isset($person->id), t('Primary key is set on record created with drupal_write_record().'));
- $this->assertIdentical($person->age, 0, t('Age field set to default value.'));
- $this->assertIdentical($person->job, 'Undefined', t('Job field set to default value.'));
+ $this->assertTrue($insert_result == SAVED_NEW, 'Correct value returned when a record is inserted with drupal_write_record() for a table with a single-field primary key.');
+ $this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
+ $this->assertIdentical($person->age, 0, 'Age field set to default value.');
+ $this->assertIdentical($person->job, 'Undefined', 'Job field set to default value.');
// Verify that the record was inserted.
$result = db_query("SELECT * FROM {test} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'John', t('Name field set.'));
- $this->assertIdentical($result->age, '0', t('Age field set to default value.'));
- $this->assertIdentical($result->job, 'Undefined', t('Job field set to default value.'));
- $this->assertFalse(isset($result->unknown_column), t('Unknown column was ignored.'));
+ $this->assertIdentical($result->name, 'John', 'Name field set.');
+ $this->assertIdentical($result->age, '0', 'Age field set to default value.');
+ $this->assertIdentical($result->job, 'Undefined', 'Job field set to default value.');
+ $this->assertFalse(isset($result->unknown_column), 'Unknown column was ignored.');
// Update the newly created record.
$person->name = 'Peter';
$person->age = 27;
$person->job = NULL;
$update_result = drupal_write_record('test', $person, array('id'));
- $this->assertTrue($update_result == SAVED_UPDATED, t('Correct value returned when a record updated with drupal_write_record() for table with single-field primary key.'));
+ $this->assertTrue($update_result == SAVED_UPDATED, 'Correct value returned when a record updated with drupal_write_record() for table with single-field primary key.');
// Verify that the record was updated.
$result = db_query("SELECT * FROM {test} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Peter', t('Name field set.'));
- $this->assertIdentical($result->age, '27', t('Age field set.'));
- $this->assertIdentical($result->job, '', t('Job field set and cast to string.'));
+ $this->assertIdentical($result->name, 'Peter', 'Name field set.');
+ $this->assertIdentical($result->age, '27', 'Age field set.');
+ $this->assertIdentical($result->job, '', 'Job field set and cast to string.');
// Try to insert NULL in columns that does not allow this.
$person = new stdClass();
@@ -1601,65 +1601,65 @@ class DrupalDataApiTest extends DrupalWebTestCase {
$person->age = NULL;
$person->job = NULL;
$insert_result = drupal_write_record('test', $person);
- $this->assertTrue(isset($person->id), t('Primary key is set on record created with drupal_write_record().'));
+ $this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
$result = db_query("SELECT * FROM {test} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Ringo', t('Name field set.'));
- $this->assertIdentical($result->age, '0', t('Age field set.'));
- $this->assertIdentical($result->job, '', t('Job field set.'));
+ $this->assertIdentical($result->name, 'Ringo', 'Name field set.');
+ $this->assertIdentical($result->age, '0', 'Age field set.');
+ $this->assertIdentical($result->job, '', 'Job field set.');
// Insert a record - the "age" column allows NULL.
$person = new stdClass();
$person->name = 'Paul';
$person->age = NULL;
$insert_result = drupal_write_record('test_null', $person);
- $this->assertTrue(isset($person->id), t('Primary key is set on record created with drupal_write_record().'));
+ $this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
$result = db_query("SELECT * FROM {test_null} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Paul', t('Name field set.'));
- $this->assertIdentical($result->age, NULL, t('Age field set.'));
+ $this->assertIdentical($result->name, 'Paul', 'Name field set.');
+ $this->assertIdentical($result->age, NULL, 'Age field set.');
// Insert a record - do not specify the value of a column that allows NULL.
$person = new stdClass();
$person->name = 'Meredith';
$insert_result = drupal_write_record('test_null', $person);
- $this->assertTrue(isset($person->id), t('Primary key is set on record created with drupal_write_record().'));
- $this->assertIdentical($person->age, 0, t('Age field set to default value.'));
+ $this->assertTrue(isset($person->id), 'Primary key is set on record created with drupal_write_record().');
+ $this->assertIdentical($person->age, 0, 'Age field set to default value.');
$result = db_query("SELECT * FROM {test_null} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Meredith', t('Name field set.'));
- $this->assertIdentical($result->age, '0', t('Age field set to default value.'));
+ $this->assertIdentical($result->name, 'Meredith', 'Name field set.');
+ $this->assertIdentical($result->age, '0', 'Age field set to default value.');
// Update the newly created record.
$person->name = 'Mary';
$person->age = NULL;
$update_result = drupal_write_record('test_null', $person, array('id'));
$result = db_query("SELECT * FROM {test_null} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Mary', t('Name field set.'));
- $this->assertIdentical($result->age, NULL, t('Age field set.'));
+ $this->assertIdentical($result->name, 'Mary', 'Name field set.');
+ $this->assertIdentical($result->age, NULL, 'Age field set.');
// Insert a record - the "data" column should be serialized.
$person = new stdClass();
$person->name = 'Dave';
$update_result = drupal_write_record('test_serialized', $person);
$result = db_query("SELECT * FROM {test_serialized} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical($result->name, 'Dave', t('Name field set.'));
- $this->assertIdentical($result->info, NULL, t('Info field set.'));
+ $this->assertIdentical($result->name, 'Dave', 'Name field set.');
+ $this->assertIdentical($result->info, NULL, 'Info field set.');
$person->info = array();
$update_result = drupal_write_record('test_serialized', $person, array('id'));
$result = db_query("SELECT * FROM {test_serialized} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical(unserialize($result->info), array(), t('Info field updated.'));
+ $this->assertIdentical(unserialize($result->info), array(), 'Info field updated.');
// Update the serialized record.
$data = array('foo' => 'bar', 1 => 2, 'empty' => '', 'null' => NULL);
$person->info = $data;
$update_result = drupal_write_record('test_serialized', $person, array('id'));
$result = db_query("SELECT * FROM {test_serialized} WHERE id = :id", array(':id' => $person->id))->fetchObject();
- $this->assertIdentical(unserialize($result->info), $data, t('Info field updated.'));
+ $this->assertIdentical(unserialize($result->info), $data, 'Info field updated.');
// Run an update query where no field values are changed. The database
// layer should return zero for number of affected rows, but
// db_write_record() should still return SAVED_UPDATED.
$update_result = drupal_write_record('test_null', $person, array('id'));
- $this->assertTrue($update_result == SAVED_UPDATED, t('Correct value returned when a valid update is run without changing any values.'));
+ $this->assertTrue($update_result == SAVED_UPDATED, 'Correct value returned when a valid update is run without changing any values.');
// Insert an object record for a table with a multi-field primary key.
$node_access = new stdClass();
@@ -1667,11 +1667,11 @@ class DrupalDataApiTest extends DrupalWebTestCase {
$node_access->gid = mt_rand();
$node_access->realm = $this->randomName();
$insert_result = drupal_write_record('node_access', $node_access);
- $this->assertTrue($insert_result == SAVED_NEW, t('Correct value returned when a record is inserted with drupal_write_record() for a table with a multi-field primary key.'));
+ $this->assertTrue($insert_result == SAVED_NEW, 'Correct value returned when a record is inserted with drupal_write_record() for a table with a multi-field primary key.');
// Update the record.
$update_result = drupal_write_record('node_access', $node_access, array('nid', 'gid', 'realm'));
- $this->assertTrue($update_result == SAVED_UPDATED, t('Correct value returned when a record is updated with drupal_write_record() for a table with a multi-field primary key.'));
+ $this->assertTrue($update_result == SAVED_UPDATED, 'Correct value returned when a record is updated with drupal_write_record() for a table with a multi-field primary key.');
}
}
@@ -1709,7 +1709,7 @@ class DrupalErrorCollectionUnitTest extends DrupalWebTestCase {
function testErrorCollect() {
$this->collectedErrors = array();
$this->drupalGet('error-test/generate-warnings-with-report');
- $this->assertEqual(count($this->collectedErrors), 3, t('Three errors were collected'));
+ $this->assertEqual(count($this->collectedErrors), 3, 'Three errors were collected');
if (count($this->collectedErrors) == 3) {
$this->assertError($this->collectedErrors[0], 'Notice', 'error_test_generate_warnings()', 'error_test.module', 'Undefined variable: bananas');
@@ -1738,11 +1738,11 @@ class DrupalErrorCollectionUnitTest extends DrupalWebTestCase {
* Assert that a collected error matches what we are expecting.
*/
function assertError($error, $group, $function, $file, $message = NULL) {
- $this->assertEqual($error['group'], $group, t("Group was %group", array('%group' => $group)));
- $this->assertEqual($error['caller']['function'], $function, t("Function was %function", array('%function' => $function)));
- $this->assertEqual(basename($error['caller']['file']), $file, t("File was %file", array('%file' => $file)));
+ $this->assertEqual($error['group'], $group, "Group was " . $group . "");
+ $this->assertEqual($error['caller']['function'], $function, "Function was " . $function . "");
+ $this->assertEqual(basename($error['caller']['file']), $file, "File was " . $file . "");
if (isset($message)) {
- $this->assertEqual($error['message'], $message, t("Message was %message", array('%message' => $message)));
+ $this->assertEqual($error['message'], $message, "Message was " . $message . "");
}
}
}
@@ -1764,9 +1764,9 @@ class ParseInfoFilesTestCase extends DrupalWebTestCase {
*/
function testParseInfoFile() {
$info_values = drupal_parse_info_file(drupal_get_path('module', 'simpletest') . '/tests/common_test_info.txt');
- $this->assertEqual($info_values['simple_string'], 'A simple string', t('Simple string value was parsed correctly.'), t('System'));
- $this->assertEqual($info_values['simple_constant'], WATCHDOG_INFO, t('Constant value was parsed correctly.'), t('System'));
- $this->assertEqual($info_values['double_colon'], 'dummyClassName::', t('Value containing double-colon was parsed correctly.'), t('System'));
+ $this->assertEqual($info_values['simple_string'], 'A simple string', 'Simple string value was parsed correctly.', 'System');
+ $this->assertEqual($info_values['simple_constant'], WATCHDOG_INFO, 'Constant value was parsed correctly.', 'System');
+ $this->assertEqual($info_values['double_colon'], 'dummyClassName::', 'Value containing double-colon was parsed correctly.', 'System');
}
}
@@ -1808,12 +1808,12 @@ class FormatDateUnitTest extends DrupalWebTestCase {
global $user, $language;
$timestamp = strtotime('2007-03-26T00:00:00+00:00');
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', t('Test all parameters.'));
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), 'domingo, 25-Mar-07 17:00:00 PDT', t('Test translated format.'));
- $this->assertIdentical(format_date($timestamp, 'custom', '\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), 'l, 25-Mar-07 17:00:00 PDT', t('Test an escaped format string.'));
- $this->assertIdentical(format_date($timestamp, 'custom', '\\\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), '\\domingo, 25-Mar-07 17:00:00 PDT', t('Test format containing backslash character.'));
- $this->assertIdentical(format_date($timestamp, 'custom', '\\\\\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), '\\l, 25-Mar-07 17:00:00 PDT', t('Test format containing backslash followed by escaped format string.'));
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London', 'en'), 'Monday, 26-Mar-07 01:00:00 BST', t('Test a different time zone.'));
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', 'Test all parameters.');
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), 'domingo, 25-Mar-07 17:00:00 PDT', 'Test translated format.');
+ $this->assertIdentical(format_date($timestamp, 'custom', '\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), 'l, 25-Mar-07 17:00:00 PDT', 'Test an escaped format string.');
+ $this->assertIdentical(format_date($timestamp, 'custom', '\\\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), '\\domingo, 25-Mar-07 17:00:00 PDT', 'Test format containing backslash character.');
+ $this->assertIdentical(format_date($timestamp, 'custom', '\\\\\\l, d-M-y H:i:s T', 'America/Los_Angeles', self::LANGCODE), '\\l, 25-Mar-07 17:00:00 PDT', 'Test format containing backslash followed by escaped format string.');
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London', 'en'), 'Monday, 26-Mar-07 01:00:00 BST', 'Test a different time zone.');
// Create an admin user and add Spanish language.
$admin_user = $this->drupalCreateUser(array('administer languages'));
@@ -1843,13 +1843,13 @@ class FormatDateUnitTest extends DrupalWebTestCase {
// Simulate a Drupal bootstrap with the logged-in user.
date_default_timezone_set(drupal_get_user_timezone());
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', t('Test a different language.'));
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London'), 'Monday, 26-Mar-07 01:00:00 BST', t('Test a different time zone.'));
- $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T'), 'domingo, 25-Mar-07 17:00:00 PDT', t('Test custom date format.'));
- $this->assertIdentical(format_date($timestamp, 'long'), 'domingo, 25. marzo 2007 - 17:00', t('Test long date format.'));
- $this->assertIdentical(format_date($timestamp, 'medium'), '25. marzo 2007 - 17:00', t('Test medium date format.'));
- $this->assertIdentical(format_date($timestamp, 'short'), '2007 Mar 25 - 5:00pm', t('Test short date format.'));
- $this->assertIdentical(format_date($timestamp), '25. marzo 2007 - 17:00', t('Test default date format.'));
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'America/Los_Angeles', 'en'), 'Sunday, 25-Mar-07 17:00:00 PDT', 'Test a different language.');
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T', 'Europe/London'), 'Monday, 26-Mar-07 01:00:00 BST', 'Test a different time zone.');
+ $this->assertIdentical(format_date($timestamp, 'custom', 'l, d-M-y H:i:s T'), 'domingo, 25-Mar-07 17:00:00 PDT', 'Test custom date format.');
+ $this->assertIdentical(format_date($timestamp, 'long'), 'domingo, 25. marzo 2007 - 17:00', 'Test long date format.');
+ $this->assertIdentical(format_date($timestamp, 'medium'), '25. marzo 2007 - 17:00', 'Test medium date format.');
+ $this->assertIdentical(format_date($timestamp, 'short'), '2007 Mar 25 - 5:00pm', 'Test short date format.');
+ $this->assertIdentical(format_date($timestamp), '25. marzo 2007 - 17:00', 'Test default date format.');
// Restore the original user and language, and enable session saving.
$user = $real_user;
@@ -1877,15 +1877,15 @@ class DrupalAttributesUnitTest extends DrupalUnitTestCase {
*/
function testDrupalAttributes() {
// Verify that special characters are HTML encoded.
- $this->assertIdentical(drupal_attributes(array('title' => '&"\'<>')), ' title="&amp;&quot;&#039;&lt;&gt;"', t('HTML encode attribute values.'));
+ $this->assertIdentical(drupal_attributes(array('title' => '&"\'<>')), ' title="&amp;&quot;&#039;&lt;&gt;"', 'HTML encode attribute values.');
// Verify multi-value attributes are concatenated with spaces.
$attributes = array('class' => array('first', 'last'));
- $this->assertIdentical(drupal_attributes(array('class' => array('first', 'last'))), ' class="first last"', t('Concatenate multi-value attributes.'));
+ $this->assertIdentical(drupal_attributes(array('class' => array('first', 'last'))), ' class="first last"', 'Concatenate multi-value attributes.');
// Verify empty attribute values are rendered.
- $this->assertIdentical(drupal_attributes(array('alt' => '')), ' alt=""', t('Empty attribute value #1.'));
- $this->assertIdentical(drupal_attributes(array('alt' => NULL)), ' alt=""', t('Empty attribute value #2.'));
+ $this->assertIdentical(drupal_attributes(array('alt' => '')), ' alt=""', 'Empty attribute value #1.');
+ $this->assertIdentical(drupal_attributes(array('alt' => NULL)), ' alt=""', 'Empty attribute value #2.');
// Verify multiple attributes are rendered.
$attributes = array(
@@ -1893,10 +1893,10 @@ class DrupalAttributesUnitTest extends DrupalUnitTestCase {
'class' => array('first', 'last'),
'alt' => 'Alternate',
);
- $this->assertIdentical(drupal_attributes($attributes), ' id="id-test" class="first last" alt="Alternate"', t('Multiple attributes.'));
+ $this->assertIdentical(drupal_attributes($attributes), ' id="id-test" class="first last" alt="Alternate"', 'Multiple attributes.');
// Verify empty attributes array is rendered.
- $this->assertIdentical(drupal_attributes(array()), '', t('Empty attributes array.'));
+ $this->assertIdentical(drupal_attributes(array()), '', 'Empty attributes array.');
}
}
@@ -1919,7 +1919,7 @@ class DrupalJSONTest extends DrupalUnitTestCase {
// Setup a string with the full ASCII table.
// @todo: Add tests for non-ASCII characters and Unicode.
$str = '';
- for ($i=0; $i < 128; $i++) {
+ for ($i = 0; $i < 128; $i++) {
$str .= chr($i);
}
// Characters that must be escaped.
@@ -1927,33 +1927,33 @@ class DrupalJSONTest extends DrupalUnitTestCase {
$html_unsafe_escaped = array('\u003c', '\u003e', '\u0026');
// Verify there aren't character encoding problems with the source string.
- $this->assertIdentical(strlen($str), 128, t('A string with the full ASCII table has the correct length.'));
+ $this->assertIdentical(strlen($str), 128, 'A string with the full ASCII table has the correct length.');
foreach ($html_unsafe as $char) {
- $this->assertTrue(strpos($str, $char) > 0, t('A string with the full ASCII table includes @s.', array('@s' => $char)));
+ $this->assertTrue(strpos($str, $char) > 0, 'A string with the full ASCII table includes ' . $char . '.');
}
// Verify that JSON encoding produces a string with all of the characters.
$json = drupal_json_encode($str);
- $this->assertTrue(strlen($json) > strlen($str), t('A JSON encoded string is larger than the source string.'));
+ $this->assertTrue(strlen($json) > strlen($str), 'A JSON encoded string is larger than the source string.');
// Verify that encoding/decoding is reversible.
$json_decoded = drupal_json_decode($json);
- $this->assertIdentical($str, $json_decoded, t('Encoding a string to JSON and decoding back results in the original string.'));
+ $this->assertIdentical($str, $json_decoded, 'Encoding a string to JSON and decoding back results in the original string.');
// Verify reversibility for structured data. Also verify that necessary
// characters are escaped.
$source = array(TRUE, FALSE, 0, 1, '0', '1', $str, array('key1' => $str, 'key2' => array('nested' => TRUE)));
$json = drupal_json_encode($source);
foreach ($html_unsafe as $char) {
- $this->assertTrue(strpos($json, $char) === FALSE, t('A JSON encoded string does not contain @s.', array('@s' => $char)));
+ $this->assertTrue(strpos($json, $char) === FALSE, 'A JSON encoded string does not contain ' . $char . '.');
}
// Verify that JSON encoding escapes the HTML unsafe characters
foreach ($html_unsafe_escaped as $char) {
- $this->assertTrue(strpos($json, $char) > 0, t('A JSON encoded string contains @s.', array('@s' => $char)));
+ $this->assertTrue(strpos($json, $char) > 0, 'A JSON encoded string contains ' . $char . '.');
}
$json_decoded = drupal_json_decode($json);
- $this->assertNotIdentical($source, $json, t('An array encoded in JSON is not identical to the source.'));
- $this->assertIdentical($source, $json_decoded, t('Encoding structured data to JSON and decoding back results in the original data.'));
+ $this->assertNotIdentical($source, $json, 'An array encoded in JSON is not identical to the source.');
+ $this->assertIdentical($source, $json_decoded, 'Encoding structured data to JSON and decoding back results in the original data.');
}
}
@@ -1982,9 +1982,9 @@ class DrupalGetRdfNamespacesTestCase extends DrupalWebTestCase {
$xml = new SimpleXMLElement($this->content);
$ns = $xml->getDocNamespaces();
- $this->assertEqual($ns['owl'], 'http://www.w3.org/2002/07/owl#', t('A prefix declared once is displayed.'));
- $this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', t('The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.'));
- $this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', t('Two prefixes can be assigned the same namespace.'));
- $this->assertTrue(!isset($ns['dc']), t('A prefix with conflicting namespaces is discarded.'));
+ $this->assertEqual($ns['owl'], 'http://www.w3.org/2002/07/owl#', 'A prefix declared once is displayed.');
+ $this->assertEqual($ns['foaf'], 'http://xmlns.com/foaf/0.1/', 'The same prefix declared in several implementations of hook_rdf_namespaces() is valid as long as all the namespaces are the same.');
+ $this->assertEqual($ns['foaf1'], 'http://xmlns.com/foaf/0.1/', 'Two prefixes can be assigned the same namespace.');
+ $this->assertTrue(!isset($ns['dc']), 'A prefix with conflicting namespaces is discarded.');
}
}
diff --git a/modules/simpletest/tests/database_test.test b/modules/simpletest/tests/database_test.test
index b2efa6672..7f5efcf9f 100644
--- a/modules/simpletest/tests/database_test.test
+++ b/modules/simpletest/tests/database_test.test
@@ -48,7 +48,7 @@ class DatabaseTestCase extends DrupalWebTestCase {
}
foreach ($schema as $name => $data) {
- $this->assertTrue(db_table_exists($name), t('Table @name created successfully.', array('@name' => $name)));
+ $this->assertTrue(db_table_exists($name), 'Table ' . $name . ' created successfully.');
}
}
@@ -191,25 +191,25 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
$db1 = Database::getConnection('default', 'default');
$db2 = Database::getConnection('slave', 'default');
- $this->assertNotNull($db1, t('default connection is a real connection object.'));
- $this->assertNotNull($db2, t('slave connection is a real connection object.'));
- $this->assertNotIdentical($db1, $db2, t('Each target refers to a different connection.'));
+ $this->assertNotNull($db1, 'default connection is a real connection object.');
+ $this->assertNotNull($db2, 'slave connection is a real connection object.');
+ $this->assertNotIdentical($db1, $db2, 'Each target refers to a different connection.');
// Try to open those targets another time, that should return the same objects.
$db1b = Database::getConnection('default', 'default');
$db2b = Database::getConnection('slave', 'default');
- $this->assertIdentical($db1, $db1b, t('A second call to getConnection() returns the same object.'));
- $this->assertIdentical($db2, $db2b, t('A second call to getConnection() returns the same object.'));
+ $this->assertIdentical($db1, $db1b, 'A second call to getConnection() returns the same object.');
+ $this->assertIdentical($db2, $db2b, 'A second call to getConnection() returns the same object.');
// Try to open an unknown target.
$unknown_target = $this->randomName();
$db3 = Database::getConnection($unknown_target, 'default');
- $this->assertNotNull($db3, t('Opening an unknown target returns a real connection object.'));
- $this->assertIdentical($db1, $db3, t('An unknown target opens the default connection.'));
+ $this->assertNotNull($db3, 'Opening an unknown target returns a real connection object.');
+ $this->assertIdentical($db1, $db3, 'An unknown target opens the default connection.');
// Try to open that unknown target another time, that should return the same object.
$db3b = Database::getConnection($unknown_target, 'default');
- $this->assertIdentical($db3, $db3b, t('A second call to getConnection() returns the same object.'));
+ $this->assertIdentical($db3, $db3b, 'A second call to getConnection() returns the same object.');
}
/**
@@ -227,7 +227,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
$db1 = Database::getConnection('default', 'default');
$db2 = Database::getConnection('slave', 'default');
- $this->assertIdentical($db1, $db2, t('Both targets refer to the same connection.'));
+ $this->assertIdentical($db1, $db2, 'Both targets refer to the same connection.');
}
/**
@@ -242,7 +242,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
$db2 = Database::getConnection('default', 'default');
// Opening a connection after closing it should yield an object different than the original.
- $this->assertNotIdentical($db1, $db2, t('Opening the default connection after it is closed returns a new object.'));
+ $this->assertNotIdentical($db1, $db2, 'Opening the default connection after it is closed returns a new object.');
}
/**
@@ -257,8 +257,8 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
// In the MySQL driver, the port can be different, so check individual
// options.
- $this->assertEqual($connection_info['default']['driver'], $connectionOptions['driver'], t('The default connection info driver matches the current connection options driver.'));
- $this->assertEqual($connection_info['default']['database'], $connectionOptions['database'], t('The default connection info database matches the current connection options database.'));
+ $this->assertEqual($connection_info['default']['driver'], $connectionOptions['driver'], 'The default connection info driver matches the current connection options driver.');
+ $this->assertEqual($connection_info['default']['database'], $connectionOptions['database'], 'The default connection info database matches the current connection options database.');
// Set up identical slave and confirm connection options are identical.
Database::addConnectionInfo('default', 'slave', $connection_info['default']);
@@ -267,7 +267,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
// Get a fresh copy of the default connection options.
$connectionOptions = $db->getConnectionOptions();
- $this->assertIdentical($connectionOptions, $connectionOptions2, t('The default and slave connection options are identical.'));
+ $this->assertIdentical($connectionOptions, $connectionOptions2, 'The default and slave connection options are identical.');
// Set up a new connection with different connection info.
$test = $connection_info['default'];
@@ -277,7 +277,7 @@ class DatabaseConnectionTestCase extends DatabaseTestCase {
// Get a fresh copy of the default connection options.
$connectionOptions = $db->getConnectionOptions();
- $this->assertNotEqual($connection_info['default']['database'], $connectionOptions['database'], t('The test connection info database does not match the current connection options database.'));
+ $this->assertNotEqual($connection_info['default']['database'], $connectionOptions['database'], 'The test connection info database does not match the current connection options database.');
}
}
@@ -302,14 +302,14 @@ class DatabaseFetchTestCase extends DatabaseTestCase {
function testQueryFetchDefault() {
$records = array();
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25));
- $this->assertTrue($result instanceof DatabaseStatementInterface, t('Result set is a Drupal statement object.'));
+ $this->assertTrue($result instanceof DatabaseStatementInterface, 'Result set is a Drupal statement object.');
foreach ($result as $record) {
$records[] = $record;
- $this->assertTrue(is_object($record), t('Record is an object.'));
- $this->assertIdentical($record->name, 'John', t('25 year old is John.'));
+ $this->assertTrue(is_object($record), 'Record is an object.');
+ $this->assertIdentical($record->name, 'John', '25 year old is John.');
}
- $this->assertIdentical(count($records), 1, t('There is only one record.'));
+ $this->assertIdentical(count($records), 1, 'There is only one record.');
}
/**
@@ -320,11 +320,11 @@ class DatabaseFetchTestCase extends DatabaseTestCase {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_OBJ));
foreach ($result as $record) {
$records[] = $record;
- $this->assertTrue(is_object($record), t('Record is an object.'));
- $this->assertIdentical($record->name, 'John', t('25 year old is John.'));
+ $this->assertTrue(is_object($record), 'Record is an object.');
+ $this->assertIdentical($record->name, 'John', '25 year old is John.');
}
- $this->assertIdentical(count($records), 1, t('There is only one record.'));
+ $this->assertIdentical(count($records), 1, 'There is only one record.');
}
/**
@@ -335,12 +335,12 @@ class DatabaseFetchTestCase extends DatabaseTestCase {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_ASSOC));
foreach ($result as $record) {
$records[] = $record;
- if ($this->assertTrue(is_array($record), t('Record is an array.'))) {
- $this->assertIdentical($record['name'], 'John', t('Record can be accessed associatively.'));
+ if ($this->assertTrue(is_array($record), 'Record is an array.')) {
+ $this->assertIdentical($record['name'], 'John', 'Record can be accessed associatively.');
}
}
- $this->assertIdentical(count($records), 1, t('There is only one record.'));
+ $this->assertIdentical(count($records), 1, 'There is only one record.');
}
/**
@@ -353,12 +353,12 @@ class DatabaseFetchTestCase extends DatabaseTestCase {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => 'FakeRecord'));
foreach ($result as $record) {
$records[] = $record;
- if ($this->assertTrue($record instanceof FakeRecord, t('Record is an object of class FakeRecord.'))) {
- $this->assertIdentical($record->name, 'John', t('25 year old is John.'));
+ if ($this->assertTrue($record instanceof FakeRecord, 'Record is an object of class FakeRecord.')) {
+ $this->assertIdentical($record->name, 'John', '25 year old is John.');
}
}
- $this->assertIdentical(count($records), 1, t('There is only one record.'));
+ $this->assertIdentical(count($records), 1, 'There is only one record.');
}
}
@@ -387,8 +387,8 @@ class DatabaseFetch2TestCase extends DatabaseTestCase {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_NUM));
foreach ($result as $record) {
$records[] = $record;
- if ($this->assertTrue(is_array($record), t('Record is an array.'))) {
- $this->assertIdentical($record[0], 'John', t('Record can be accessed numerically.'));
+ if ($this->assertTrue(is_array($record), 'Record is an array.')) {
+ $this->assertIdentical($record[0], 'John', 'Record can be accessed numerically.');
}
}
@@ -403,13 +403,13 @@ class DatabaseFetch2TestCase extends DatabaseTestCase {
$result = db_query('SELECT name FROM {test} WHERE age = :age', array(':age' => 25), array('fetch' => PDO::FETCH_BOTH));
foreach ($result as $record) {
$records[] = $record;
- if ($this->assertTrue(is_array($record), t('Record is an array.'))) {
- $this->assertIdentical($record[0], 'John', t('Record can be accessed numerically.'));
- $this->assertIdentical($record['name'], 'John', t('Record can be accessed associatively.'));
+ if ($this->assertTrue(is_array($record), 'Record is an array.')) {
+ $this->assertIdentical($record[0], 'John', 'Record can be accessed numerically.');
+ $this->assertIdentical($record['name'], 'John', 'Record can be accessed associatively.');
}
}
- $this->assertIdentical(count($records), 1, t('There is only one record.'));
+ $this->assertIdentical(count($records), 1, 'There is only one record.');
}
/**
@@ -419,12 +419,12 @@ class DatabaseFetch2TestCase extends DatabaseTestCase {
$records = array();
$result = db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25));
$column = $result->fetchCol();
- $this->assertIdentical(count($column), 3, t('fetchCol() returns the right number of records.'));
+ $this->assertIdentical(count($column), 3, 'fetchCol() returns the right number of records.');
$result = db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25));
$i = 0;
foreach ($result as $record) {
- $this->assertIdentical($record->name, $column[$i++], t('Column matches direct accesss.'));
+ $this->assertIdentical($record->name, $column[$i++], 'Column matches direct accesss.');
}
}
}
@@ -456,9 +456,9 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
$query->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
- $this->assertIdentical($num_records_before + 1, (int) $num_records_after, t('Record inserts correctly.'));
+ $this->assertIdentical($num_records_before + 1, (int) $num_records_after, 'Record inserts correctly.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Yoko'))->fetchField();
- $this->assertIdentical($saved_age, '29', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '29', 'Can retrieve after inserting.');
}
/**
@@ -485,13 +485,13 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
$query->execute();
$num_records_after = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField();
- $this->assertIdentical($num_records_before + 3, $num_records_after, t('Record inserts correctly.'));
+ $this->assertIdentical($num_records_before + 3, $num_records_after, 'Record inserts correctly.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Larry'))->fetchField();
- $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Curly'))->fetchField();
- $this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Moe'))->fetchField();
- $this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.');
}
/**
@@ -506,7 +506,7 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
'name' => 'Larry',
'age' => '30',
));
- $query->execute(); // This should run the insert, but leave the fields intact.
+ $query->execute(); // This should run the insert, but leave the fields intact.
// We should be able to specify values in any order if named.
$query->values(array(
@@ -520,13 +520,13 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
$query->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
- $this->assertIdentical((int) $num_records_before + 3, (int) $num_records_after, t('Record inserts correctly.'));
+ $this->assertIdentical((int) $num_records_before + 3, (int) $num_records_after, 'Record inserts correctly.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Larry'))->fetchField();
- $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Curly'))->fetchField();
- $this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Moe'))->fetchField();
- $this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.');
}
/**
@@ -542,11 +542,11 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
->values(array('Moe', '32'))
->execute();
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Larry'))->fetchField();
- $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Curly'))->fetchField();
- $this->assertIdentical($saved_age, '31', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '31', 'Can retrieve after inserting.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Moe'))->fetchField();
- $this->assertIdentical($saved_age, '32', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '32', 'Can retrieve after inserting.');
}
/**
@@ -560,7 +560,7 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
))
->execute();
- $this->assertIdentical($id, '5', t('Auto-increment ID returned successfully.'));
+ $this->assertIdentical($id, '5', 'Auto-increment ID returned successfully.');
}
/**
@@ -573,7 +573,7 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
// re-ordered.
$query->addExpression('tp.age', 'age');
$query
- ->fields('tp', array('name','job'))
+ ->fields('tp', array('name', 'job'))
->condition('tp.name', 'Meredith');
// The resulting query should be equivalent to:
@@ -586,7 +586,7 @@ class DatabaseInsertTestCase extends DatabaseTestCase {
->execute();
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Meredith'))->fetchField();
- $this->assertIdentical($saved_age, '30', t('Can retrieve after inserting.'));
+ $this->assertIdentical($saved_age, '30', 'Can retrieve after inserting.');
}
}
@@ -608,12 +608,12 @@ class DatabaseInsertLOBTestCase extends DatabaseTestCase {
*/
function testInsertOneBlob() {
$data = "This is\000a test.";
- $this->assertTrue(strlen($data) === 15, t('Test data contains a NULL.'));
+ $this->assertTrue(strlen($data) === 15, 'Test data contains a NULL.');
$id = db_insert('test_one_blob')
->fields(array('blob1' => $data))
->execute();
$r = db_query('SELECT * FROM {test_one_blob} WHERE id = :id', array(':id' => $id))->fetchAssoc();
- $this->assertTrue($r['blob1'] === $data, t('Can insert a blob: id @id, @data.', array('@id' => $id, '@data' => serialize($r))));
+ $this->assertTrue($r['blob1'] === $data, 'Can insert a blob: id ' . $id . ', ' . serialize($r) . '.');
}
/**
@@ -627,7 +627,7 @@ class DatabaseInsertLOBTestCase extends DatabaseTestCase {
))
->execute();
$r = db_query('SELECT * FROM {test_two_blobs} WHERE id = :id', array(':id' => $id))->fetchAssoc();
- $this->assertTrue($r['blob1'] === 'This is' && $r['blob2'] === 'a test', t('Can insert multiple blobs per row.'));
+ $this->assertTrue($r['blob1'] === 'This is' && $r['blob2'] === 'a test', 'Can insert multiple blobs per row.');
}
}
@@ -654,7 +654,7 @@ class DatabaseInsertDefaultsTestCase extends DatabaseTestCase {
$schema = drupal_get_schema('test');
$job = db_query('SELECT job FROM {test} WHERE id = :id', array(':id' => $id))->fetchField();
- $this->assertEqual($job, $schema['fields']['job']['default'], t('Default field value is set.'));
+ $this->assertEqual($job, $schema['fields']['job']['default'], 'Default field value is set.');
}
/**
@@ -666,13 +666,14 @@ class DatabaseInsertDefaultsTestCase extends DatabaseTestCase {
try {
$result = db_insert('test')->execute();
// This is only executed if no exception has been thrown.
- $this->fail(t('Expected exception NoFieldsException has not been thrown.'));
- } catch (NoFieldsException $e) {
- $this->pass(t('Expected exception NoFieldsException has been thrown.'));
+ $this->fail('Expected exception NoFieldsException has not been thrown.');
+ }
+ catch (NoFieldsException $e) {
+ $this->pass('Expected exception NoFieldsException has been thrown.');
}
$num_records_after = (int) db_query('SELECT COUNT(*) FROM {test}')->fetchField();
- $this->assertIdentical($num_records_before, $num_records_after, t('Do nothing as no fields are specified.'));
+ $this->assertIdentical($num_records_before, $num_records_after, 'Do nothing as no fields are specified.');
}
/**
@@ -687,7 +688,7 @@ class DatabaseInsertDefaultsTestCase extends DatabaseTestCase {
$schema = drupal_get_schema('test');
$job = db_query('SELECT job FROM {test} WHERE id = :id', array(':id' => $id))->fetchField();
- $this->assertEqual($job, $schema['fields']['job']['default'], t('Default field value is set.'));
+ $this->assertEqual($job, $schema['fields']['job']['default'], 'Default field value is set.');
}
}
@@ -712,10 +713,10 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->fields(array('name' => 'Tiffany'))
->condition('id', 1)
->execute();
- $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
+ $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
$saved_name = db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 1))->fetchField();
- $this->assertIdentical($saved_name, 'Tiffany', t('Updated name successfully.'));
+ $this->assertIdentical($saved_name, 'Tiffany', 'Updated name successfully.');
}
/**
@@ -726,10 +727,10 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('job', 'Singer')
->execute();
- $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
+ $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
+ $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
}
/**
@@ -740,10 +741,10 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('age', 26, '>')
->execute();
- $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
+ $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
+ $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
}
/**
@@ -754,10 +755,10 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->where('age > :age', array(':age' => 26))
->execute();
- $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
+ $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
+ $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
}
/**
@@ -769,10 +770,10 @@ class DatabaseUpdateTestCase extends DatabaseTestCase {
->where('age > :age', array(':age' => 26))
->condition('name', 'Ringo');
$num_updated = $update->execute();
- $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
+ $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '1', t('Updated fields successfully.'));
+ $this->assertIdentical($num_matches, '1', 'Updated fields successfully.');
}
}
@@ -801,10 +802,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->condition('name', 'Paul')
);
$num_updated = $update->execute();
- $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
+ $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
+ $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
}
/**
@@ -815,10 +816,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('name', array('John', 'Paul'), 'IN')
->execute();
- $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
+ $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
+ $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
}
/**
@@ -831,10 +832,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('name', array('John', 'Paul', 'George'), 'NoT IN')
->execute();
- $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
+ $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '1', t('Updated fields successfully.'));
+ $this->assertIdentical($num_matches, '1', 'Updated fields successfully.');
}
/**
@@ -845,10 +846,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('age', array(25, 26), 'BETWEEN')
->execute();
- $this->assertIdentical($num_updated, 2, t('Updated 2 records.'));
+ $this->assertIdentical($num_updated, 2, 'Updated 2 records.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '2', t('Updated fields successfully.'));
+ $this->assertIdentical($num_matches, '2', 'Updated fields successfully.');
}
/**
@@ -859,10 +860,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->condition('name', '%ge%', 'LIKE')
->execute();
- $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
+ $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '1', t('Updated fields successfully.'));
+ $this->assertIdentical($num_matches, '1', 'Updated fields successfully.');
}
/**
@@ -876,15 +877,15 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->fields(array('job' => 'Musician'))
->expression('age', 'age + :age', array(':age' => 4))
->execute();
- $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
+ $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
$num_matches = db_query('SELECT COUNT(*) FROM {test} WHERE job = :job', array(':job' => 'Musician'))->fetchField();
- $this->assertIdentical($num_matches, '1', t('Updated fields successfully.'));
+ $this->assertIdentical($num_matches, '1', 'Updated fields successfully.');
$person = db_query('SELECT * FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetch();
- $this->assertEqual($person->name, 'Ringo', t('Name set correctly.'));
- $this->assertEqual($person->age, $before_age + 4, t('Age set correctly.'));
- $this->assertEqual($person->job, 'Musician', t('Job set correctly.'));
+ $this->assertEqual($person->name, 'Ringo', 'Name set correctly.');
+ $this->assertEqual($person->age, $before_age + 4, 'Age set correctly.');
+ $this->assertEqual($person->job, 'Musician', 'Job set correctly.');
$GLOBALS['larry_test'] = 0;
}
@@ -897,10 +898,10 @@ class DatabaseUpdateComplexTestCase extends DatabaseTestCase {
->condition('name', 'Ringo')
->expression('age', 'age + :age', array(':age' => 4))
->execute();
- $this->assertIdentical($num_updated, 1, t('Updated 1 record.'));
+ $this->assertIdentical($num_updated, 1, 'Updated 1 record.');
$after_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'))->fetchField();
- $this->assertEqual($before_age + 4, $after_age, t('Age updated correctly'));
+ $this->assertEqual($before_age + 4, $after_age, 'Age updated correctly');
}
}
@@ -922,7 +923,7 @@ class DatabaseUpdateLOBTestCase extends DatabaseTestCase {
*/
function testUpdateOneBlob() {
$data = "This is\000a test.";
- $this->assertTrue(strlen($data) === 15, t('Test data contains a NULL.'));
+ $this->assertTrue(strlen($data) === 15, 'Test data contains a NULL.');
$id = db_insert('test_one_blob')
->fields(array('blob1' => $data))
->execute();
@@ -934,7 +935,7 @@ class DatabaseUpdateLOBTestCase extends DatabaseTestCase {
->execute();
$r = db_query('SELECT * FROM {test_one_blob} WHERE id = :id', array(':id' => $id))->fetchAssoc();
- $this->assertTrue($r['blob1'] === $data, t('Can update a blob: id @id, @data.', array('@id' => $id, '@data' => serialize($r))));
+ $this->assertTrue($r['blob1'] === $data, 'Can update a blob: id ' . $id . ', ' . serialize($r) . '.');
}
/**
@@ -954,7 +955,7 @@ class DatabaseUpdateLOBTestCase extends DatabaseTestCase {
->execute();
$r = db_query('SELECT * FROM {test_two_blobs} WHERE id = :id', array(':id' => $id))->fetchAssoc();
- $this->assertTrue($r['blob1'] === 'and so' && $r['blob2'] === 'is this', t('Can update multiple blobs per row.'));
+ $this->assertTrue($r['blob1'] === 'and so' && $r['blob2'] === 'is this', 'Can update multiple blobs per row.');
}
}
@@ -994,10 +995,10 @@ class DatabaseDeleteTruncateTestCase extends DatabaseTestCase {
->condition('pid', $subquery, 'IN');
$num_deleted = $delete->execute();
- $this->assertEqual($num_deleted, 1, t("Deleted 1 record."));
+ $this->assertEqual($num_deleted, 1, "Deleted 1 record.");
$num_records_after = db_query('SELECT COUNT(*) FROM {test_task}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after + $num_deleted, t('Deletion adds up.'));
+ $this->assertEqual($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.');
}
/**
@@ -1009,10 +1010,10 @@ class DatabaseDeleteTruncateTestCase extends DatabaseTestCase {
$num_deleted = db_delete('test')
->condition('id', 1)
->execute();
- $this->assertIdentical($num_deleted, 1, t('Deleted 1 record.'));
+ $this->assertIdentical($num_deleted, 1, 'Deleted 1 record.');
$num_records_after = db_query('SELECT COUNT(*) FROM {test}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after + $num_deleted, t('Deletion adds up.'));
+ $this->assertEqual($num_records_before, $num_records_after + $num_deleted, 'Deletion adds up.');
}
/**
@@ -1024,7 +1025,7 @@ class DatabaseDeleteTruncateTestCase extends DatabaseTestCase {
db_truncate('test')->execute();
$num_records_after = db_query("SELECT COUNT(*) FROM {test}")->fetchField();
- $this->assertEqual(0, $num_records_after, t('Truncate really deletes everything.'));
+ $this->assertEqual(0, $num_records_after, 'Truncate really deletes everything.');
}
}
@@ -1055,15 +1056,15 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
))
->execute();
- $this->assertEqual($result, MergeQuery::STATUS_INSERT, t('Insert status returned.'));
+ $this->assertEqual($result, MergeQuery::STATUS_INSERT, 'Insert status returned.');
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before + 1, $num_records_after, t('Merge inserted properly.'));
+ $this->assertEqual($num_records_before + 1, $num_records_after, 'Merge inserted properly.');
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Presenter'))->fetch();
- $this->assertEqual($person->name, 'Tiffany', t('Name set correctly.'));
- $this->assertEqual($person->age, 31, t('Age set correctly.'));
- $this->assertEqual($person->job, 'Presenter', t('Job set correctly.'));
+ $this->assertEqual($person->name, 'Tiffany', 'Name set correctly.');
+ $this->assertEqual($person->age, 31, 'Age set correctly.');
+ $this->assertEqual($person->job, 'Presenter', 'Job set correctly.');
}
/**
@@ -1080,15 +1081,15 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
))
->execute();
- $this->assertEqual($result, MergeQuery::STATUS_UPDATE, t('Update status returned.'));
+ $this->assertEqual($result, MergeQuery::STATUS_UPDATE, 'Update status returned.');
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.'));
+ $this->assertEqual($num_records_before, $num_records_after, 'Merge updated properly.');
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Tiffany', t('Name set correctly.'));
- $this->assertEqual($person->age, 31, t('Age set correctly.'));
- $this->assertEqual($person->job, 'Speaker', t('Job set correctly.'));
+ $this->assertEqual($person->name, 'Tiffany', 'Name set correctly.');
+ $this->assertEqual($person->age, 31, 'Age set correctly.');
+ $this->assertEqual($person->job, 'Speaker', 'Job set correctly.');
}
/**
@@ -1107,12 +1108,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.'));
+ $this->assertEqual($num_records_before, $num_records_after, 'Merge updated properly.');
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Tiffany', t('Name set correctly.'));
- $this->assertEqual($person->age, 30, t('Age skipped correctly.'));
- $this->assertEqual($person->job, 'Speaker', t('Job set correctly.'));
+ $this->assertEqual($person->name, 'Tiffany', 'Name set correctly.');
+ $this->assertEqual($person->age, 30, 'Age skipped correctly.');
+ $this->assertEqual($person->job, 'Speaker', 'Job set correctly.');
}
/**
@@ -1131,12 +1132,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.'));
+ $this->assertEqual($num_records_before, $num_records_after, 'Merge updated properly.');
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Joe', t('Name set correctly.'));
- $this->assertEqual($person->age, 30, t('Age skipped correctly.'));
- $this->assertEqual($person->job, 'Speaker', t('Job set correctly.'));
+ $this->assertEqual($person->name, 'Joe', 'Name set correctly.');
+ $this->assertEqual($person->age, 30, 'Age skipped correctly.');
+ $this->assertEqual($person->job, 'Speaker', 'Job set correctly.');
}
/**
@@ -1162,12 +1163,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, t('Merge updated properly.'));
+ $this->assertEqual($num_records_before, $num_records_after, 'Merge updated properly.');
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Tiffany', t('Name set correctly.'));
- $this->assertEqual($person->age, $age_before + 4, t('Age updated correctly.'));
- $this->assertEqual($person->job, 'Speaker', t('Job set correctly.'));
+ $this->assertEqual($person->name, 'Tiffany', 'Name set correctly.');
+ $this->assertEqual($person->age, $age_before + 4, 'Age updated correctly.');
+ $this->assertEqual($person->job, 'Speaker', 'Job set correctly.');
}
/**
@@ -1181,12 +1182,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before + 1, $num_records_after, t('Merge inserted properly.'));
+ $this->assertEqual($num_records_before + 1, $num_records_after, 'Merge inserted properly.');
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Presenter'))->fetch();
- $this->assertEqual($person->name, '', t('Name set correctly.'));
- $this->assertEqual($person->age, 0, t('Age set correctly.'));
- $this->assertEqual($person->job, 'Presenter', t('Job set correctly.'));
+ $this->assertEqual($person->name, '', 'Name set correctly.');
+ $this->assertEqual($person->age, 0, 'Age set correctly.');
+ $this->assertEqual($person->job, 'Presenter', 'Job set correctly.');
}
/**
@@ -1200,12 +1201,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, t('Merge skipped properly.'));
+ $this->assertEqual($num_records_before, $num_records_after, 'Merge skipped properly.');
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Meredith', t('Name skipped correctly.'));
- $this->assertEqual($person->age, 30, t('Age skipped correctly.'));
- $this->assertEqual($person->job, 'Speaker', t('Job skipped correctly.'));
+ $this->assertEqual($person->name, 'Meredith', 'Name skipped correctly.');
+ $this->assertEqual($person->age, 30, 'Age skipped correctly.');
+ $this->assertEqual($person->job, 'Speaker', 'Job skipped correctly.');
db_merge('test_people')
->key(array('job' => 'Speaker'))
@@ -1214,12 +1215,12 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {test_people}')->fetchField();
- $this->assertEqual($num_records_before, $num_records_after, t('Merge skipped properly.'));
+ $this->assertEqual($num_records_before, $num_records_after, 'Merge skipped properly.');
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', array(':job' => 'Speaker'))->fetch();
- $this->assertEqual($person->name, 'Meredith', t('Name skipped correctly.'));
- $this->assertEqual($person->age, 30, t('Age skipped correctly.'));
- $this->assertEqual($person->job, 'Speaker', t('Job skipped correctly.'));
+ $this->assertEqual($person->name, 'Meredith', 'Name skipped correctly.');
+ $this->assertEqual($person->age, 30, 'Age skipped correctly.');
+ $this->assertEqual($person->job, 'Speaker', 'Job skipped correctly.');
}
/**
@@ -1236,10 +1237,10 @@ class DatabaseMergeTestCase extends DatabaseTestCase {
->execute();
}
catch (InvalidMergeQueryException $e) {
- $this->pass(t('InvalidMergeQueryException thrown for invalid query.'));
+ $this->pass('InvalidMergeQueryException thrown for invalid query.');
return;
}
- $this->fail(t('No InvalidMergeQueryException thrown'));
+ $this->fail('No InvalidMergeQueryException thrown');
}
}
@@ -1270,7 +1271,7 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$num_records++;
}
- $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
+ $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
}
/**
@@ -1287,11 +1288,11 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$num_records++;
}
- $query = (string)$query;
+ $query = (string) $query;
$expected = "/* Testing query comments */ SELECT test.name AS name, test.age AS age\nFROM \n{test} test";
- $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
- $this->assertEqual($query, $expected, t('The flattened query contains the comment string.'));
+ $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
+ $this->assertEqual($query, $expected, 'The flattened query contains the comment string.');
}
/**
@@ -1305,13 +1306,13 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$result = $query->execute();
// Check that the aliases are being created the way we want.
- $this->assertEqual($name_field, 'name', t('Name field alias is correct.'));
- $this->assertEqual($age_field, 'age', t('Age field alias is correct.'));
+ $this->assertEqual($name_field, 'name', 'Name field alias is correct.');
+ $this->assertEqual($age_field, 'age', 'Age field alias is correct.');
// Ensure that we got the right record.
$record = $result->fetch();
- $this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
- $this->assertEqual($record->$age_field, 27, t('Fetched age is correct.'));
+ $this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
+ $this->assertEqual($record->$age_field, 27, 'Fetched age is correct.');
}
/**
@@ -1325,13 +1326,13 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$result = $query->execute();
// Check that the aliases are being created the way we want.
- $this->assertEqual($name_field, 'name', t('Name field alias is correct.'));
- $this->assertEqual($age_field, 'double_age', t('Age field alias is correct.'));
+ $this->assertEqual($name_field, 'name', 'Name field alias is correct.');
+ $this->assertEqual($age_field, 'double_age', 'Age field alias is correct.');
// Ensure that we got the right record.
$record = $result->fetch();
- $this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
- $this->assertEqual($record->$age_field, 27*2, t('Fetched age expression is correct.'));
+ $this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
+ $this->assertEqual($record->$age_field, 27 * 2, 'Fetched age expression is correct.');
}
/**
@@ -1346,14 +1347,14 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$result = $query->execute();
// Check that the aliases are being created the way we want.
- $this->assertEqual($age_double_field, 'expression', t('Double age field alias is correct.'));
- $this->assertEqual($age_triple_field, 'expression_2', t('Triple age field alias is correct.'));
+ $this->assertEqual($age_double_field, 'expression', 'Double age field alias is correct.');
+ $this->assertEqual($age_triple_field, 'expression_2', 'Triple age field alias is correct.');
// Ensure that we got the right record.
$record = $result->fetch();
- $this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
- $this->assertEqual($record->$age_double_field, 27*2, t('Fetched double age expression is correct.'));
- $this->assertEqual($record->$age_triple_field, 27*3, t('Fetched triple age expression is correct.'));
+ $this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
+ $this->assertEqual($record->$age_double_field, 27 * 2, 'Fetched double age expression is correct.');
+ $this->assertEqual($record->$age_triple_field, 27 * 3, 'Fetched triple age expression is correct.');
}
/**
@@ -1366,17 +1367,17 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->execute()->fetchObject();
// Check that all fields we asked for are present.
- $this->assertNotNull($record->id, t('ID field is present.'));
- $this->assertNotNull($record->name, t('Name field is present.'));
- $this->assertNotNull($record->age, t('Age field is present.'));
- $this->assertNotNull($record->job, t('Job field is present.'));
+ $this->assertNotNull($record->id, 'ID field is present.');
+ $this->assertNotNull($record->name, 'Name field is present.');
+ $this->assertNotNull($record->age, 'Age field is present.');
+ $this->assertNotNull($record->job, 'Job field is present.');
// Ensure that we got the right record.
// Check that all fields we asked for are present.
- $this->assertEqual($record->id, 2, t('ID field has the correct value.'));
- $this->assertEqual($record->name, 'George', t('Name field has the correct value.'));
- $this->assertEqual($record->age, 27, t('Age field has the correct value.'));
- $this->assertEqual($record->job, 'Singer', t('Job field has the correct value.'));
+ $this->assertEqual($record->id, 2, 'ID field has the correct value.');
+ $this->assertEqual($record->name, 'George', 'Name field has the correct value.');
+ $this->assertEqual($record->age, 27, 'Age field has the correct value.');
+ $this->assertEqual($record->job, 'Singer', 'Job field has the correct value.');
}
/**
@@ -1389,17 +1390,17 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->execute()->fetchObject();
// Check that all fields we asked for are present.
- $this->assertNotNull($record->id, t('ID field is present.'));
- $this->assertNotNull($record->name, t('Name field is present.'));
- $this->assertNotNull($record->age, t('Age field is present.'));
- $this->assertNotNull($record->job, t('Job field is present.'));
+ $this->assertNotNull($record->id, 'ID field is present.');
+ $this->assertNotNull($record->name, 'Name field is present.');
+ $this->assertNotNull($record->age, 'Age field is present.');
+ $this->assertNotNull($record->job, 'Job field is present.');
// Ensure that we got the right record.
// Check that all fields we asked for are present.
- $this->assertEqual($record->id, 2, t('ID field has the correct value.'));
- $this->assertEqual($record->name, 'George', t('Name field has the correct value.'));
- $this->assertEqual($record->age, 27, t('Age field has the correct value.'));
- $this->assertEqual($record->job, 'Singer', t('Job field has the correct value.'));
+ $this->assertEqual($record->id, 2, 'ID field has the correct value.');
+ $this->assertEqual($record->name, 'George', 'Name field has the correct value.');
+ $this->assertEqual($record->age, 27, 'Age field has the correct value.');
+ $this->assertEqual($record->job, 'Singer', 'Job field has the correct value.');
}
/**
@@ -1413,8 +1414,8 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->isNull('age')
->execute()->fetchCol();
- $this->assertEqual(count($names), 1, t('Correct number of records found with NULL age.'));
- $this->assertEqual($names[0], 'Fozzie', t('Correct record returned for NULL age.'));
+ $this->assertEqual(count($names), 1, 'Correct number of records found with NULL age.');
+ $this->assertEqual($names[0], 'Fozzie', 'Correct record returned for NULL age.');
}
/**
@@ -1429,9 +1430,9 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->orderBy('name')
->execute()->fetchCol();
- $this->assertEqual(count($names), 2, t('Correct number of records found withNOT NULL age.'));
- $this->assertEqual($names[0], 'Gonzo', t('Correct record returned for NOT NULL age.'));
- $this->assertEqual($names[1], 'Kermit', t('Correct record returned for NOT NULL age.'));
+ $this->assertEqual(count($names), 2, 'Correct number of records found withNOT NULL age.');
+ $this->assertEqual($names[0], 'Gonzo', 'Correct record returned for NOT NULL age.');
+ $this->assertEqual($names[1], 'Kermit', 'Correct record returned for NOT NULL age.');
}
/**
@@ -1452,10 +1453,10 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$names = $query_1->execute()->fetchCol();
// Ensure we only get 2 records.
- $this->assertEqual(count($names), 2, t('UNION correctly discarded duplicates.'));
+ $this->assertEqual(count($names), 2, 'UNION correctly discarded duplicates.');
- $this->assertEqual($names[0], 'George', t('First query returned correct name.'));
- $this->assertEqual($names[1], 'Ringo', t('Second query returned correct name.'));
+ $this->assertEqual($names[0], 'George', 'First query returned correct name.');
+ $this->assertEqual($names[1], 'Ringo', 'Second query returned correct name.');
}
/**
@@ -1475,11 +1476,11 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
$names = $query_1->execute()->fetchCol();
// Ensure we get all 3 records.
- $this->assertEqual(count($names), 3, t('UNION ALL correctly preserved duplicates.'));
+ $this->assertEqual(count($names), 3, 'UNION ALL correctly preserved duplicates.');
- $this->assertEqual($names[0], 'George', t('First query returned correct first name.'));
- $this->assertEqual($names[1], 'Ringo', t('Second query returned correct second name.'));
- $this->assertEqual($names[2], 'Ringo', t('Third query returned correct name.'));
+ $this->assertEqual($names[0], 'George', 'First query returned correct first name.');
+ $this->assertEqual($names[1], 'Ringo', 'Second query returned correct second name.');
+ $this->assertEqual($names[2], 'Ringo', 'Third query returned correct name.');
}
/**
@@ -1514,7 +1515,7 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->orderBy('id')
->execute()
->fetchCol();
- $this->assertEqual($ordered_ids, $expected_ids, t('A query without random ordering returns IDs in the correct order.'));
+ $this->assertEqual($ordered_ids, $expected_ids, 'A query without random ordering returns IDs in the correct order.');
// Now perform the same query, but instead choose a random ordering. We
// expect this to contain a differently ordered version of the original
@@ -1525,10 +1526,10 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->orderRandom()
->execute()
->fetchCol();
- $this->assertNotEqual($randomized_ids, $ordered_ids, t('A query with random ordering returns an unordered set of IDs.'));
+ $this->assertNotEqual($randomized_ids, $ordered_ids, 'A query with random ordering returns an unordered set of IDs.');
$sorted_ids = $randomized_ids;
sort($sorted_ids);
- $this->assertEqual($sorted_ids, $ordered_ids, t('After sorting the random list, the result matches the original query.'));
+ $this->assertEqual($sorted_ids, $ordered_ids, 'After sorting the random list, the result matches the original query.');
// Now perform the exact same query again, and make sure the order is
// different.
@@ -1538,10 +1539,10 @@ class DatabaseSelectTestCase extends DatabaseTestCase {
->orderRandom()
->execute()
->fetchCol();
- $this->assertNotEqual($randomized_ids_second_set, $randomized_ids, t('Performing the query with random ordering a second time returns IDs in a different order.'));
+ $this->assertNotEqual($randomized_ids_second_set, $randomized_ids, 'Performing the query with random ordering a second time returns IDs in a different order.');
$sorted_ids_second_set = $randomized_ids_second_set;
sort($sorted_ids_second_set);
- $this->assertEqual($sorted_ids_second_set, $sorted_ids, t('After sorting the second random list, the result matches the sorted version of the first random list.'));
+ $this->assertEqual($sorted_ids_second_set, $sorted_ids, 'After sorting the second random list, the result matches the sorted version of the first random list.');
}
/**
@@ -1593,7 +1594,7 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase {
// WHERE tt.task = 'code'
$people = $select->execute()->fetchCol();
- $this->assertEqual(count($people), 1, t('Returned the correct number of rows.'));
+ $this->assertEqual(count($people), 1, 'Returned the correct number of rows.');
}
/**
@@ -1619,7 +1620,7 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase {
// INNER JOIN test t ON t.id=tt.pid
$people = $select->execute()->fetchCol();
- $this->assertEqual(count($people), 1, t('Returned the correct number of rows.'));
+ $this->assertEqual(count($people), 1, 'Returned the correct number of rows.');
}
/**
@@ -1642,7 +1643,7 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase {
// FROM test tt2
// WHERE tt2.pid IN (SELECT tt.pid AS pid FROM test_task tt WHERE tt.priority=1)
$people = $select->execute()->fetchCol();
- $this->assertEqual(count($people), 5, t('Returned the correct number of rows.'));
+ $this->assertEqual(count($people), 5, 'Returned the correct number of rows.');
}
/**
@@ -1666,7 +1667,7 @@ class DatabaseSelectSubqueryTestCase extends DatabaseTestCase {
// INNER JOIN (SELECT tt.pid AS pid FROM test_task tt WHERE priority=1) tt ON t.id=tt.pid
$people = $select->execute()->fetchCol();
- $this->assertEqual(count($people), 2, t('Returned the correct number of rows.'));
+ $this->assertEqual(count($people), 2, 'Returned the correct number of rows.');
}
}
@@ -1697,11 +1698,11 @@ class DatabaseSelectOrderedTestCase extends DatabaseTestCase {
$last_age = 0;
foreach ($result as $record) {
$num_records++;
- $this->assertTrue($record->age >= $last_age, t('Results returned in correct order.'));
+ $this->assertTrue($record->age >= $last_age, 'Results returned in correct order.');
$last_age = $record->age;
}
- $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
+ $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
}
/**
@@ -1728,11 +1729,11 @@ class DatabaseSelectOrderedTestCase extends DatabaseTestCase {
$num_records++;
foreach ($record as $kk => $col) {
if ($expected[$k][$kk] != $results[$k][$kk]) {
- $this->assertTrue(FALSE, t('Results returned in correct order.'));
+ $this->assertTrue(FALSE, 'Results returned in correct order.');
}
}
}
- $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
+ $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
}
/**
@@ -1749,11 +1750,11 @@ class DatabaseSelectOrderedTestCase extends DatabaseTestCase {
$last_age = 100000000;
foreach ($result as $record) {
$num_records++;
- $this->assertTrue($record->age <= $last_age, t('Results returned in correct order.'));
+ $this->assertTrue($record->age <= $last_age, 'Results returned in correct order.');
$last_age = $record->age;
}
- $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
+ $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
}
}
@@ -1787,12 +1788,12 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$last_priority = 0;
foreach ($result as $record) {
$num_records++;
- $this->assertTrue($record->$priority_field >= $last_priority, t('Results returned in correct order.'));
- $this->assertNotEqual($record->$name_field, 'Ringo', t('Taskless person not selected.'));
+ $this->assertTrue($record->$priority_field >= $last_priority, 'Results returned in correct order.');
+ $this->assertNotEqual($record->$name_field, 'Ringo', 'Taskless person not selected.');
$last_priority = $record->$priority_field;
}
- $this->assertEqual($num_records, 7, t('Returned the correct number of rows.'));
+ $this->assertEqual($num_records, 7, 'Returned the correct number of rows.');
}
/**
@@ -1813,11 +1814,11 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
foreach ($result as $record) {
$num_records++;
- $this->assertTrue(strcmp($record->$name_field, $last_name) >= 0, t('Results returned in correct order.'));
+ $this->assertTrue(strcmp($record->$name_field, $last_name) >= 0, 'Results returned in correct order.');
$last_priority = $record->$name_field;
}
- $this->assertEqual($num_records, 8, t('Returned the correct number of rows.'));
+ $this->assertEqual($num_records, 8, 'Returned the correct number of rows.');
}
/**
@@ -1836,7 +1837,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$records = array();
foreach ($result as $record) {
$num_records++;
- $this->assertTrue($record->$count_field >= $last_count, t('Results returned in correct order.'));
+ $this->assertTrue($record->$count_field >= $last_count, 'Results returned in correct order.');
$last_count = $record->$count_field;
$records[$record->$task_field] = $record->$count_field;
}
@@ -1850,10 +1851,10 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
);
foreach ($correct_results as $task => $count) {
- $this->assertEqual($records[$task], $count, t("Correct number of '@task' records found.", array('@task' => $task)));
+ $this->assertEqual($records[$task], $count, "Correct number of '" . $task . "' records found.");
}
- $this->assertEqual($num_records, 6, t('Returned the correct number of total rows.'));
+ $this->assertEqual($num_records, 6, 'Returned the correct number of total rows.');
}
/**
@@ -1873,8 +1874,8 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$records = array();
foreach ($result as $record) {
$num_records++;
- $this->assertTrue($record->$count_field >= 2, t('Record has the minimum count.'));
- $this->assertTrue($record->$count_field >= $last_count, t('Results returned in correct order.'));
+ $this->assertTrue($record->$count_field >= 2, 'Record has the minimum count.');
+ $this->assertTrue($record->$count_field >= $last_count, 'Results returned in correct order.');
$last_count = $record->$count_field;
$records[$record->$task_field] = $record->$count_field;
}
@@ -1884,10 +1885,10 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
);
foreach ($correct_results as $task => $count) {
- $this->assertEqual($records[$task], $count, t("Correct number of '@task' records found.", array('@task' => $task)));
+ $this->assertEqual($records[$task], $count, "Correct number of '" . $task . "' records found.");
}
- $this->assertEqual($num_records, 1, t('Returned the correct number of total rows.'));
+ $this->assertEqual($num_records, 1, 'Returned the correct number of total rows.');
}
/**
@@ -1905,7 +1906,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$num_records++;
}
- $this->assertEqual($num_records, 2, t('Returned the correct number of rows.'));
+ $this->assertEqual($num_records, 2, 'Returned the correct number of rows.');
}
/**
@@ -1922,7 +1923,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$num_records++;
}
- $this->assertEqual($num_records, 6, t('Returned the correct number of rows.'));
+ $this->assertEqual($num_records, 6, 'Returned the correct number of rows.');
}
/**
@@ -1936,13 +1937,13 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$count = $query->countQuery()->execute()->fetchField();
- $this->assertEqual($count, 4, t('Counted the correct number of records.'));
+ $this->assertEqual($count, 4, 'Counted the correct number of records.');
// Now make sure we didn't break the original query! We should still have
// all of the fields we asked for.
$record = $query->execute()->fetch();
- $this->assertEqual($record->$name_field, 'George', t('Correct data retrieved.'));
- $this->assertEqual($record->$age_field, 27, t('Correct data retrieved.'));
+ $this->assertEqual($record->$name_field, 'George', 'Correct data retrieved.');
+ $this->assertEqual($record->$age_field, 27, 'Correct data retrieved.');
}
/**
@@ -1957,20 +1958,20 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
// Check that the 'all_fields' statement is handled properly.
$tables = $query->getTables();
- $this->assertEqual($tables['test']['all_fields'], 1, t('Query correctly sets \'all_fields\' statement.'));
+ $this->assertEqual($tables['test']['all_fields'], 1, 'Query correctly sets \'all_fields\' statement.');
$tables = $count->getTables();
- $this->assertFalse(isset($tables['test']['all_fields']), t('Count query correctly unsets \'all_fields\' statement.'));
+ $this->assertFalse(isset($tables['test']['all_fields']), 'Count query correctly unsets \'all_fields\' statement.');
// Check that the ordering clause is handled properly.
$orderby = $query->getOrderBy();
- $this->assertEqual($orderby['name'], 'ASC', t('Query correctly sets ordering clause.'));
+ $this->assertEqual($orderby['name'], 'ASC', 'Query correctly sets ordering clause.');
$orderby = $count->getOrderBy();
- $this->assertFalse(isset($orderby['name']), t('Count query correctly unsets ordering caluse.'));
+ $this->assertFalse(isset($orderby['name']), 'Count query correctly unsets ordering caluse.');
// Make sure that the count query works.
$count = $count->execute()->fetchField();
- $this->assertEqual($count, 4, t('Counted the correct number of records.'));
+ $this->assertEqual($count, 4, 'Counted the correct number of records.');
}
/**
@@ -1983,7 +1984,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$count = $query->countQuery()->execute()->fetchField();
- $this->assertEqual($count, 6, t('Counted the correct number of records.'));
+ $this->assertEqual($count, 6, 'Counted the correct number of records.');
}
/**
@@ -2000,7 +2001,7 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$query->condition(db_or()->condition('age', 26)->condition('age', 27));
$job = $query->execute()->fetchField();
- $this->assertEqual($job, 'Songwriter', t('Correct data retrieved.'));
+ $this->assertEqual($job, 'Songwriter', 'Correct data retrieved.');
}
/**
@@ -2013,8 +2014,8 @@ class DatabaseSelectComplexTestCase extends DatabaseTestCase {
$query->addField($alias, 'job', 'otherjob');
$query->where("$alias.name <> test.name");
$crowded_job = $query->execute()->fetch();
- $this->assertEqual($crowded_job->job, $crowded_job->otherjob, t('Correctly joined same table twice.'));
- $this->assertNotEqual($crowded_job->name, $crowded_job->othername, t('Correctly joined same table twice.'));
+ $this->assertEqual($crowded_job->job, $crowded_job->otherjob, 'Correctly joined same table twice.');
+ $this->assertNotEqual($crowded_job->name, $crowded_job->othername, 'Correctly joined same table twice.');
}
}
@@ -2058,7 +2059,7 @@ class DatabaseSelectPagerDefaultTestCase extends DatabaseTestCase {
$correct_number = $count - ($limit * $page);
}
- $this->assertEqual(count($data->names), $correct_number, t('Correct number of records returned by pager: @number', array('@number' => $correct_number)));
+ $this->assertEqual(count($data->names), $correct_number, 'Correct number of records returned by pager: ' . $correct_number);
}
}
@@ -2092,7 +2093,7 @@ class DatabaseSelectPagerDefaultTestCase extends DatabaseTestCase {
$correct_number = $count - ($limit * $page);
}
- $this->assertEqual(count($data->names), $correct_number, t('Correct number of records returned by pager: @number', array('@number' => $correct_number)));
+ $this->assertEqual(count($data->names), $correct_number, 'Correct number of records returned by pager: ' . $correct_number);
}
}
@@ -2114,7 +2115,7 @@ class DatabaseSelectPagerDefaultTestCase extends DatabaseTestCase {
$ages = $outer_query
->execute()
->fetchCol();
- $this->assertEqual($ages, array(25, 26, 27, 28), t('Inner pager query returned the correct ages.'));
+ $this->assertEqual($ages, array(25, 26, 27, 28), 'Inner pager query returned the correct ages.');
}
/**
@@ -2134,7 +2135,7 @@ class DatabaseSelectPagerDefaultTestCase extends DatabaseTestCase {
$ages = $query
->execute()
->fetchCol();
- $this->assertEqual($ages, array('George', 'Ringo'), t('Pager query with having expression returned the correct ages.'));
+ $this->assertEqual($ages, array('George', 'Ringo'), 'Pager query with having expression returned the correct ages.');
}
}
@@ -2172,8 +2173,8 @@ class DatabaseSelectTableSortDefaultTestCase extends DatabaseTestCase {
$first = array_shift($data->tasks);
$last = array_pop($data->tasks);
- $this->assertEqual($first->task, $sort['first'], t('Items appear in the correct order.'));
- $this->assertEqual($last->task, $sort['last'], t('Items appear in the correct order.'));
+ $this->assertEqual($first->task, $sort['first'], 'Items appear in the correct order.');
+ $this->assertEqual($last->task, $sort['last'], 'Items appear in the correct order.');
}
}
@@ -2198,8 +2199,8 @@ class DatabaseSelectTableSortDefaultTestCase extends DatabaseTestCase {
$first = array_shift($data->tasks);
$last = array_pop($data->tasks);
- $this->assertEqual($first->task, $sort['first'], t('Items appear in the correct order sorting by @field @sort.', array('@field' => $sort['field'], '@sort' => $sort['sort'])));
- $this->assertEqual($last->task, $sort['last'], t('Items appear in the correct order sorting by @field @sort.', array('@field' => $sort['field'], '@sort' => $sort['sort'])));
+ $this->assertEqual($first->task, $sort['first'], 'Items appear in the correct order sorting by ' . $sort['field'] . ' ' . $sort['sort'] . '.');
+ $this->assertEqual($last->task, $sort['last'], 'Items appear in the correct order sorting by ' . $sort['field'] . ' ' . $sort['sort'] . '.');
}
}
}
@@ -2230,8 +2231,8 @@ class DatabaseTaggingTestCase extends DatabaseTestCase {
$query->addTag('test');
- $this->assertTrue($query->hasTag('test'), t('hasTag() returned true.'));
- $this->assertFalse($query->hasTag('other'), t('hasTag() returned false.'));
+ $this->assertTrue($query->hasTag('test'), 'hasTag() returned true.');
+ $this->assertFalse($query->hasTag('other'), 'hasTag() returned false.');
}
/**
@@ -2245,8 +2246,8 @@ class DatabaseTaggingTestCase extends DatabaseTestCase {
$query->addTag('test');
$query->addTag('other');
- $this->assertTrue($query->hasAllTags('test', 'other'), t('hasAllTags() returned true.'));
- $this->assertFalse($query->hasAllTags('test', 'stuff'), t('hasAllTags() returned false.'));
+ $this->assertTrue($query->hasAllTags('test', 'other'), 'hasAllTags() returned true.');
+ $this->assertFalse($query->hasAllTags('test', 'stuff'), 'hasAllTags() returned false.');
}
/**
@@ -2259,8 +2260,8 @@ class DatabaseTaggingTestCase extends DatabaseTestCase {
$query->addTag('test');
- $this->assertTrue($query->hasAnyTag('test', 'other'), t('hasAnyTag() returned true.'));
- $this->assertFalse($query->hasAnyTag('other', 'stuff'), t('hasAnyTag() returned false.'));
+ $this->assertTrue($query->hasAnyTag('test', 'other'), 'hasAnyTag() returned true.');
+ $this->assertFalse($query->hasAnyTag('other', 'stuff'), 'hasAnyTag() returned false.');
}
/**
@@ -2281,10 +2282,10 @@ class DatabaseTaggingTestCase extends DatabaseTestCase {
$query->addMetaData('test', $data);
$return = $query->getMetaData('test');
- $this->assertEqual($data, $return, t('Corect metadata returned.'));
+ $this->assertEqual($data, $return, 'Corect metadata returned.');
$return = $query->getMetaData('nothere');
- $this->assertNull($return, t('Non-existent key returned NULL.'));
+ $this->assertNull($return, 'Non-existent key returned NULL.');
}
}
@@ -2319,7 +2320,7 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$num_records++;
}
- $this->assertEqual($num_records, 2, t('Returned the correct number of rows.'));
+ $this->assertEqual($num_records, 2, 'Returned the correct number of rows.');
}
/**
@@ -2336,14 +2337,14 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$records = $result->fetchAll();
- $this->assertEqual(count($records), 2, t('Returned the correct number of rows.'));
+ $this->assertEqual(count($records), 2, 'Returned the correct number of rows.');
- $this->assertEqual($records[0]->name, 'George', t('Correct data retrieved.'));
- $this->assertEqual($records[0]->$tid_field, 4, t('Correct data retrieved.'));
- $this->assertEqual($records[0]->$task_field, 'sing', t('Correct data retrieved.'));
- $this->assertEqual($records[1]->name, 'George', t('Correct data retrieved.'));
- $this->assertEqual($records[1]->$tid_field, 5, t('Correct data retrieved.'));
- $this->assertEqual($records[1]->$task_field, 'sleep', t('Correct data retrieved.'));
+ $this->assertEqual($records[0]->name, 'George', 'Correct data retrieved.');
+ $this->assertEqual($records[0]->$tid_field, 4, 'Correct data retrieved.');
+ $this->assertEqual($records[0]->$task_field, 'sing', 'Correct data retrieved.');
+ $this->assertEqual($records[1]->name, 'George', 'Correct data retrieved.');
+ $this->assertEqual($records[1]->$tid_field, 5, 'Correct data retrieved.');
+ $this->assertEqual($records[1]->$task_field, 'sleep', 'Correct data retrieved.');
}
/**
@@ -2364,11 +2365,11 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$records = $result->fetchAll();
- $this->assertEqual(count($records), 1, t('Returned the correct number of rows.'));
- $this->assertEqual($records[0]->$name_field, 'John', t('Correct data retrieved.'));
- $this->assertEqual($records[0]->$tid_field, 2, t('Correct data retrieved.'));
- $this->assertEqual($records[0]->$pid_field, 1, t('Correct data retrieved.'));
- $this->assertEqual($records[0]->$task_field, 'sleep', t('Correct data retrieved.'));
+ $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
+ $this->assertEqual($records[0]->$name_field, 'John', 'Correct data retrieved.');
+ $this->assertEqual($records[0]->$tid_field, 2, 'Correct data retrieved.');
+ $this->assertEqual($records[0]->$pid_field, 1, 'Correct data retrieved.');
+ $this->assertEqual($records[0]->$task_field, 'sleep', 'Correct data retrieved.');
}
/**
@@ -2382,8 +2383,8 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$query->addTag('database_test_alter_change_fields');
$record = $query->execute()->fetch();
- $this->assertEqual($record->$name_field, 'George', t('Correct data retrieved.'));
- $this->assertFalse(isset($record->$age_field), t('Age field not found, as intended.'));
+ $this->assertEqual($record->$name_field, 'George', 'Correct data retrieved.');
+ $this->assertFalse(isset($record->$age_field), 'Age field not found, as intended.');
}
/**
@@ -2400,8 +2401,8 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
// Ensure that we got the right record.
$record = $result->fetch();
- $this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
- $this->assertEqual($record->$age_field, 27*3, t('Fetched age expression is correct.'));
+ $this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
+ $this->assertEqual($record->$age_field, 27 * 3, 'Fetched age expression is correct.');
}
/**
@@ -2416,7 +2417,7 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$num_records = count($query->execute()->fetchAll());
- $this->assertEqual($num_records, 4, t('Returned the correct number of rows.'));
+ $this->assertEqual($num_records, 4, 'Returned the correct number of rows.');
}
/**
@@ -2440,8 +2441,8 @@ class DatabaseAlterTestCase extends DatabaseTestCase {
$name_field = $query->addField('pq', 'name');
$record = $query->execute()->fetch();
- $this->assertEqual($record->$name_field, 'George', t('Fetched name is correct.'));
- $this->assertEqual($record->$age_field, 27*3, t('Fetched age expression is correct.'));
+ $this->assertEqual($record->$name_field, 'George', 'Fetched name is correct.');
+ $this->assertEqual($record->$age_field, 27 * 3, 'Fetched age expression is correct.');
}
}
@@ -2475,31 +2476,31 @@ class DatabaseRegressionTestCase extends DatabaseTestCase {
))->execute();
$from_database = db_query('SELECT name FROM {test} WHERE name = :name', array(':name' => $name))->fetchField();
- $this->assertIdentical($name, $from_database, t("The database handles UTF-8 characters cleanly."));
+ $this->assertIdentical($name, $from_database, "The database handles UTF-8 characters cleanly.");
}
/**
* Test the db_table_exists() function.
*/
function testDBTableExists() {
- $this->assertIdentical(TRUE, db_table_exists('node'), t('Returns true for existent table.'));
- $this->assertIdentical(FALSE, db_table_exists('nosuchtable'), t('Returns false for nonexistent table.'));
+ $this->assertIdentical(TRUE, db_table_exists('node'), 'Returns true for existent table.');
+ $this->assertIdentical(FALSE, db_table_exists('nosuchtable'), 'Returns false for nonexistent table.');
}
/**
* Test the db_field_exists() function.
*/
function testDBFieldExists() {
- $this->assertIdentical(TRUE, db_field_exists('node', 'nid'), t('Returns true for existent column.'));
- $this->assertIdentical(FALSE, db_field_exists('node', 'nosuchcolumn'), t('Returns false for nonexistent column.'));
+ $this->assertIdentical(TRUE, db_field_exists('node', 'nid'), 'Returns true for existent column.');
+ $this->assertIdentical(FALSE, db_field_exists('node', 'nosuchcolumn'), 'Returns false for nonexistent column.');
}
/**
* Test the db_index_exists() function.
*/
function testDBIndexExists() {
- $this->assertIdentical(TRUE, db_index_exists('node', 'node_created'), t('Returns true for existent index.'));
- $this->assertIdentical(FALSE, db_index_exists('node', 'nosuchindex'), t('Returns false for nonexistent index.'));
+ $this->assertIdentical(TRUE, db_index_exists('node', 'node_created'), 'Returns true for existent index.');
+ $this->assertIdentical(FALSE, db_index_exists('node', 'nosuchindex'), 'Returns false for nonexistent index.');
}
}
@@ -2527,10 +2528,10 @@ class DatabaseLoggingTestCase extends DatabaseTestCase {
$queries = Database::getLog('testing', 'default');
- $this->assertEqual(count($queries), 2, t('Correct number of queries recorded.'));
+ $this->assertEqual(count($queries), 2, 'Correct number of queries recorded.');
foreach ($queries as $query) {
- $this->assertEqual($query['caller']['function'], __FUNCTION__, t('Correct function in query log.'));
+ $this->assertEqual($query['caller']['function'], __FUNCTION__, 'Correct function in query log.');
}
}
@@ -2549,8 +2550,8 @@ class DatabaseLoggingTestCase extends DatabaseTestCase {
$queries1 = Database::getLog('testing1');
$queries2 = Database::getLog('testing2');
- $this->assertEqual(count($queries1), 2, t('Correct number of queries recorded for log 1.'));
- $this->assertEqual(count($queries2), 1, t('Correct number of queries recorded for log 2.'));
+ $this->assertEqual(count($queries1), 2, 'Correct number of queries recorded for log 1.');
+ $this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for log 2.');
}
/**
@@ -2566,13 +2567,13 @@ class DatabaseLoggingTestCase extends DatabaseTestCase {
db_query('SELECT name FROM {test} WHERE age > :age', array(':age' => 25))->fetchCol();
- db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'), array('target' => 'slave'));//->fetchCol();
+ db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'Ringo'), array('target' => 'slave')); //->fetchCol();
$queries1 = Database::getLog('testing1');
- $this->assertEqual(count($queries1), 2, t('Recorded queries from all targets.'));
- $this->assertEqual($queries1[0]['target'], 'default', t('First query used default target.'));
- $this->assertEqual($queries1[1]['target'], 'slave', t('Second query used slave target.'));
+ $this->assertEqual(count($queries1), 2, 'Recorded queries from all targets.');
+ $this->assertEqual($queries1[0]['target'], 'default', 'First query used default target.');
+ $this->assertEqual($queries1[1]['target'], 'slave', 'Second query used slave target.');
}
/**
@@ -2596,9 +2597,9 @@ class DatabaseLoggingTestCase extends DatabaseTestCase {
$queries1 = Database::getLog('testing1');
- $this->assertEqual(count($queries1), 2, t('Recorded queries from all targets.'));
- $this->assertEqual($queries1[0]['target'], 'default', t('First query used default target.'));
- $this->assertEqual($queries1[1]['target'], 'default', t('Second query used default target as fallback.'));
+ $this->assertEqual(count($queries1), 2, 'Recorded queries from all targets.');
+ $this->assertEqual($queries1[0]['target'], 'default', 'First query used default target.');
+ $this->assertEqual($queries1[1]['target'], 'default', 'Second query used default target as fallback.');
}
/**
@@ -2624,8 +2625,8 @@ class DatabaseLoggingTestCase extends DatabaseTestCase {
$queries1 = Database::getLog('testing1');
$queries2 = Database::getLog('testing1', 'test2');
- $this->assertEqual(count($queries1), 1, t('Correct number of queries recorded for first connection.'));
- $this->assertEqual(count($queries2), 1, t('Correct number of queries recorded for second connection.'));
+ $this->assertEqual(count($queries1), 1, 'Correct number of queries recorded for first connection.');
+ $this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for second connection.');
}
}
@@ -2651,12 +2652,12 @@ class DatabaseRangeQueryTestCase extends DrupalWebTestCase {
function testRangeQuery() {
// Test if return correct number of rows.
$range_rows = db_query_range("SELECT name FROM {system} ORDER BY name", 2, 3)->fetchAll();
- $this->assertEqual(count($range_rows), 3, t('Range query work and return correct number of rows.'));
+ $this->assertEqual(count($range_rows), 3, 'Range query work and return correct number of rows.');
// Test if return target data.
$raw_rows = db_query('SELECT name FROM {system} ORDER BY name')->fetchAll();
$raw_rows = array_slice($raw_rows, 2, 3);
- $this->assertEqual($range_rows, $raw_rows, t('Range query work and return target data.'));
+ $this->assertEqual($range_rows, $raw_rows, 'Range query work and return target data.');
}
}
@@ -2690,19 +2691,19 @@ class DatabaseTemporaryQueryTestCase extends DrupalWebTestCase {
$this->drupalGet('database_test/db_query_temporary');
$data = json_decode($this->drupalGetContent());
if ($data) {
- $this->assertEqual($this->countTableRows("system"), $data->row_count, t('The temporary table contains the correct amount of rows.'));
- $this->assertFalse(db_table_exists($data->table_name), t('The temporary table is, indeed, temporary.'));
+ $this->assertEqual($this->countTableRows("system"), $data->row_count, 'The temporary table contains the correct amount of rows.');
+ $this->assertFalse(db_table_exists($data->table_name), 'The temporary table is, indeed, temporary.');
}
else {
- $this->fail(t("The creation of the temporary table failed."));
+ $this->fail("The creation of the temporary table failed.");
}
// Now try to run two db_query_temporary() in the same request.
$table_name_system = db_query_temporary('SELECT status FROM {system}', array());
$table_name_users = db_query_temporary('SELECT uid FROM {users}', array());
- $this->assertEqual($this->countTableRows($table_name_system), $this->countTableRows("system"), t('A temporary table was created successfully in this request.'));
- $this->assertEqual($this->countTableRows($table_name_users), $this->countTableRows("users"), t('A second temporary table was created successfully in this request.'));
+ $this->assertEqual($this->countTableRows($table_name_system), $this->countTableRows("system"), 'A temporary table was created successfully in this request.');
+ $this->assertEqual($this->countTableRows($table_name_users), $this->countTableRows("users"), 'A second temporary table was created successfully in this request.');
}
}
@@ -2737,7 +2738,7 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase {
':a4' => ' a ',
':a5' => 'test.',
));
- $this->assertIdentical($result->fetchField(), 'This is a test.', t('Basic CONCAT works.'));
+ $this->assertIdentical($result->fetchField(), 'This is a test.', 'Basic CONCAT works.');
}
/**
@@ -2750,7 +2751,7 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase {
':a3' => '.',
':age' => 25,
));
- $this->assertIdentical($result->fetchField(), 'The age of John is 25.', t('Field CONCAT works.'));
+ $this->assertIdentical($result->fetchField(), 'The age of John is 25.', 'Field CONCAT works.');
}
/**
@@ -2769,14 +2770,14 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase {
->countQuery()
->execute()
->fetchField();
- $this->assertIdentical($num_matches, '2', t('Found 2 records.'));
+ $this->assertIdentical($num_matches, '2', 'Found 2 records.');
// Match only "Ring_" using a LIKE expression with no wildcards.
$num_matches = db_select('test', 't')
->condition('name', db_like('Ring_'), 'LIKE')
->countQuery()
->execute()
->fetchField();
- $this->assertIdentical($num_matches, '1', t('Found 1 record.'));
+ $this->assertIdentical($num_matches, '1', 'Found 1 record.');
}
/**
@@ -2800,14 +2801,14 @@ class DatabaseBasicSyntaxTestCase extends DatabaseTestCase {
->countQuery()
->execute()
->fetchField();
- $this->assertIdentical($num_matches, '2', t('Found 2 records.'));
+ $this->assertIdentical($num_matches, '2', 'Found 2 records.');
// Match only the former using a LIKE expression with no wildcards.
$num_matches = db_select('test', 't')
->condition('name', db_like('abc%\_'), 'LIKE')
->countQuery()
->execute()
->fetchField();
- $this->assertIdentical($num_matches, '1', t('Found 1 record.'));
+ $this->assertIdentical($num_matches, '1', 'Found 1 record.');
}
}
@@ -2850,7 +2851,7 @@ class DatabaseInvalidDataTestCase extends DatabaseTestCase {
'job' => 'Singer',
))
->execute();
- $this->fail(t('Insert succeedded when it should not have.'));
+ $this->fail('Insert succeedded when it should not have.');
}
catch (Exception $e) {
// Check if the first record was inserted.
@@ -2862,14 +2863,14 @@ class DatabaseInvalidDataTestCase extends DatabaseTestCase {
// Database engines that don't support transactions can leave partial
// inserts in place when an error occurs. This is the case for MySQL
// when running on a MyISAM table.
- $this->pass(t("The whole transaction has not been rolled-back when a duplicate key insert occurs, this is expected because the database doesn't support transactions"));
+ $this->pass("The whole transaction has not been rolled-back when a duplicate key insert occurs, this is expected because the database doesn't support transactions");
}
else {
- $this->fail(t('The whole transaction is rolled back when a duplicate key insert occurs.'));
+ $this->fail('The whole transaction is rolled back when a duplicate key insert occurs.');
}
}
else {
- $this->pass(t('The whole transaction is rolled back when a duplicate key insert occurs.'));
+ $this->pass('The whole transaction is rolled back when a duplicate key insert occurs.');
}
// Ensure the other values were not inserted.
@@ -2878,7 +2879,7 @@ class DatabaseInvalidDataTestCase extends DatabaseTestCase {
->condition('age', array(17, 75), 'IN')
->execute()->fetchObject();
- $this->assertFalse($record, t('The rest of the insert aborted as expected.'));
+ $this->assertFalse($record, 'The rest of the insert aborted as expected.');
}
}
@@ -2906,7 +2907,7 @@ class DatabaseQueryTestCase extends DatabaseTestCase {
function testArraySubstitution() {
$names = db_query('SELECT name FROM {test} WHERE age IN (:ages) ORDER BY age', array(':ages' => array(25, 26, 27)))->fetchAll();
- $this->assertEqual(count($names), 3, t('Correct number of names returned'));
+ $this->assertEqual(count($names), 3, 'Correct number of names returned');
}
}
@@ -2972,19 +2973,19 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
))
->execute();
- $this->assertTrue($connection->inTransaction(), t('In transaction before calling nested transaction.'));
+ $this->assertTrue($connection->inTransaction(), 'In transaction before calling nested transaction.');
// We're already in a transaction, but we call ->transactionInnerLayer
// to nest another transaction inside the current one.
$this->transactionInnerLayer($suffix, $rollback);
- $this->assertTrue($connection->inTransaction(), t('In transaction after calling nested transaction.'));
+ $this->assertTrue($connection->inTransaction(), 'In transaction after calling nested transaction.');
if ($rollback) {
// Roll back the transaction, if requested.
// This rollback should propagate to the last savepoint.
$txn->rollback();
- $this->assertTrue(($connection->transactionDepth() == $depth), t('Transaction has rolled back to the last savepoint after calling rollback().'));
+ $this->assertTrue(($connection->transactionDepth() == $depth), 'Transaction has rolled back to the last savepoint after calling rollback().');
}
}
@@ -3000,7 +3001,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
protected function transactionInnerLayer($suffix, $rollback = FALSE) {
$connection = Database::getConnection();
- $this->assertTrue($connection->inTransaction(), t('In transaction in nested transaction.'));
+ $this->assertTrue($connection->inTransaction(), 'In transaction in nested transaction.');
$depth = $connection->transactionDepth();
// Start a transaction. If we're being called from ->transactionOuterLayer,
@@ -3010,7 +3011,7 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
$txn = db_transaction();
$depth2 = $connection->transactionDepth();
- $this->assertTrue($depth < $depth2, t('Transaction depth is has increased with new transaction.'));
+ $this->assertTrue($depth < $depth2, 'Transaction depth is has increased with new transaction.');
// Insert a single row into the testing table.
db_insert('test')
@@ -3020,13 +3021,13 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
))
->execute();
- $this->assertTrue($connection->inTransaction(), t('In transaction inside nested transaction.'));
+ $this->assertTrue($connection->inTransaction(), 'In transaction inside nested transaction.');
if ($rollback) {
// Roll back the transaction, if requested.
// This rollback should propagate to the last savepoint.
$txn->rollback();
- $this->assertTrue(($connection->transactionDepth() == $depth), t('Transaction has rolled back to the last savepoint after calling rollback().'));
+ $this->assertTrue(($connection->transactionDepth() == $depth), 'Transaction has rolled back to the last savepoint after calling rollback().');
}
}
@@ -3047,9 +3048,9 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
// Neither of the rows we inserted in the two transaction layers
// should be present in the tables post-rollback.
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DavidB'))->fetchField();
- $this->assertNotIdentical($saved_age, '24', t('Cannot retrieve DavidB row after commit.'));
+ $this->assertNotIdentical($saved_age, '24', 'Cannot retrieve DavidB row after commit.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DanielB'))->fetchField();
- $this->assertNotIdentical($saved_age, '19', t('Cannot retrieve DanielB row after commit.'));
+ $this->assertNotIdentical($saved_age, '19', 'Cannot retrieve DanielB row after commit.');
}
catch (Exception $e) {
$this->fail($e->getMessage());
@@ -3073,9 +3074,9 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
// Because our current database claims to not support transactions,
// the inserted rows should be present despite the attempt to roll back.
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DavidB'))->fetchField();
- $this->assertIdentical($saved_age, '24', t('DavidB not rolled back, since transactions are not supported.'));
+ $this->assertIdentical($saved_age, '24', 'DavidB not rolled back, since transactions are not supported.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DanielB'))->fetchField();
- $this->assertIdentical($saved_age, '19', t('DanielB not rolled back, since transactions are not supported.'));
+ $this->assertIdentical($saved_age, '19', 'DanielB not rolled back, since transactions are not supported.');
}
catch (Exception $e) {
$this->fail($e->getMessage());
@@ -3095,9 +3096,9 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
// Because we committed, both of the inserted rows should be present.
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DavidA'))->fetchField();
- $this->assertIdentical($saved_age, '24', t('Can retrieve DavidA row after commit.'));
+ $this->assertIdentical($saved_age, '24', 'Can retrieve DavidA row after commit.');
$saved_age = db_query('SELECT age FROM {test} WHERE name = :name', array(':name' => 'DanielA'))->fetchField();
- $this->assertIdentical($saved_age, '19', t('Can retrieve DanielA row after commit.'));
+ $this->assertIdentical($saved_age, '19', 'Can retrieve DanielA row after commit.');
}
catch (Exception $e) {
$this->fail($e->getMessage());
@@ -3127,9 +3128,9 @@ class DatabaseNextIdCase extends DrupalWebTestCase {
// We can test for exact increase in here because we know there is no
// other process operating on these tables -- normally we could only
// expect $second > $first.
- $this->assertEqual($first + 1, $second, t('The second call from a sequence provides a number increased by one.'));
+ $this->assertEqual($first + 1, $second, 'The second call from a sequence provides a number increased by one.');
$result = db_next_id(1000);
- $this->assertEqual($result, 1001, t('Sequence provides a larger number than the existing ID.'));
+ $this->assertEqual($result, 1001, 'Sequence provides a larger number than the existing ID.');
}
}
@@ -3151,8 +3152,8 @@ class DatabaseEmptyStatementTestCase extends DrupalWebTestCase {
function testEmpty() {
$result = new DatabaseStatementEmpty();
- $this->assertTrue($result instanceof DatabaseStatementInterface, t('Class implements expected interface'));
- $this->assertNull($result->fetchObject(), t('Null result returned.'));
+ $this->assertTrue($result instanceof DatabaseStatementInterface, 'Class implements expected interface');
+ $this->assertNull($result->fetchObject(), 'Null result returned.');
}
/**
@@ -3162,11 +3163,11 @@ class DatabaseEmptyStatementTestCase extends DrupalWebTestCase {
$result = new DatabaseStatementEmpty();
foreach ($result as $record) {
- $this->fail(t('Iterating empty result set should not iterate.'));
+ $this->fail('Iterating empty result set should not iterate.');
return;
}
- $this->pass(t('Iterating empty result set skipped iteration.'));
+ $this->pass('Iterating empty result set skipped iteration.');
}
/**
@@ -3175,6 +3176,6 @@ class DatabaseEmptyStatementTestCase extends DrupalWebTestCase {
function testEmptyFetchAll() {
$result = new DatabaseStatementEmpty();
- $this->assertEqual($result->fetchAll(), array(), t('Empty array returned from empty result set.'));
+ $this->assertEqual($result->fetchAll(), array(), 'Empty array returned from empty result set.');
}
}
diff --git a/modules/simpletest/tests/entity_query.test b/modules/simpletest/tests/entity_query.test
index 0b3db8b59..5a04076f1 100644
--- a/modules/simpletest/tests/entity_query.test
+++ b/modules/simpletest/tests/entity_query.test
@@ -172,7 +172,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test entity entity_type condition.'));
+ ), 'Test entity entity_type condition.');
// Test entity_id condition.
$query = new EntityFieldQuery();
@@ -181,7 +181,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->entityCondition('entity_id', '3');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
- ), t('Test entity entity_id condition.'));
+ ), 'Test entity entity_id condition.');
$query = new EntityFieldQuery();
$query
@@ -189,7 +189,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', '3');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
- ), t('Test entity entity_id condition and entity_id property condition.'));
+ ), 'Test entity entity_id condition and entity_id property condition.');
// Test bundle condition.
$query = new EntityFieldQuery();
@@ -201,7 +201,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), t('Test entity bundle condition: bundle1.'));
+ ), 'Test entity bundle condition: bundle1.');
$query = new EntityFieldQuery();
$query
@@ -210,7 +210,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test entity bundle condition: bundle2.'));
+ ), 'Test entity bundle condition: bundle2.');
$query = new EntityFieldQuery();
$query
@@ -219,7 +219,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test entity bundle condition and bundle property condition.'));
+ ), 'Test entity bundle condition and bundle property condition.');
// Test revision_id condition.
$query = new EntityFieldQuery();
@@ -228,7 +228,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->entityCondition('revision_id', '3');
$this->assertEntityFieldQuery($query, array(
array('test_entity', 3),
- ), t('Test entity revision_id condition.'));
+ ), 'Test entity revision_id condition.');
$query = new EntityFieldQuery();
$query
@@ -236,7 +236,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftvid', '3');
$this->assertEntityFieldQuery($query, array(
array('test_entity', 3),
- ), t('Test entity revision_id condition and revision_id property condition.'));
+ ), 'Test entity revision_id condition and revision_id property condition.');
$query = new EntityFieldQuery();
$query
@@ -246,7 +246,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity', 100),
array('test_entity', 101),
- ), t('Test revision age.'));
+ ), 'Test revision age.');
// Test that fields attached to the non-revision supporting entity
// 'test_entity_bundle_key' are reachable in FIELD_LOAD_REVISION.
@@ -263,7 +263,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 2),
array('test_entity', 3),
array('test_entity', 4),
- ), t('Test that fields are reachable from FIELD_LOAD_REVISION even for non-revision entities.'));
+ ), 'Test that fields are reachable from FIELD_LOAD_REVISION even for non-revision entities.');
// Test entity sort by entity_id.
$query = new EntityFieldQuery();
@@ -277,7 +277,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test sort entity entity_id in ascending order.'), TRUE);
+ ), 'Test sort entity entity_id in ascending order.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -290,7 +290,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 1),
- ), t('Test sort entity entity_id in descending order.'), TRUE);
+ ), 'Test sort entity entity_id in descending order.', TRUE);
// Test property sort by entity id.
$query = new EntityFieldQuery();
@@ -304,7 +304,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test sort entity entity_id property in ascending order.'), TRUE);
+ ), 'Test sort entity entity_id property in ascending order.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -317,7 +317,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 1),
- ), t('Test sort entity entity_id property in descending order.'), TRUE);
+ ), 'Test sort entity entity_id property in descending order.', TRUE);
// Test entity sort by bundle.
$query = new EntityFieldQuery();
@@ -332,7 +332,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test sort entity bundle in ascending order.'), TRUE);
+ ), 'Test sort entity bundle in ascending order.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -346,7 +346,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 1),
- ), t('Test sort entity bundle in descending order.'), TRUE);
+ ), 'Test sort entity bundle in descending order.', TRUE);
// Test entity sort by revision_id.
$query = new EntityFieldQuery();
@@ -358,7 +358,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 2),
array('test_entity', 3),
array('test_entity', 4),
- ), t('Test sort entity revision_id in ascending order.'), TRUE);
+ ), 'Test sort entity revision_id in ascending order.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -369,7 +369,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 3),
array('test_entity', 2),
array('test_entity', 1),
- ), t('Test sort entity revision_id in descending order.'), TRUE);
+ ), 'Test sort entity revision_id in descending order.', TRUE);
// Test property sort by revision_id.
$query = new EntityFieldQuery();
@@ -381,7 +381,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 2),
array('test_entity', 3),
array('test_entity', 4),
- ), t('Test sort entity revision_id property in ascending order.'), TRUE);
+ ), 'Test sort entity revision_id property in ascending order.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -392,7 +392,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 3),
array('test_entity', 2),
array('test_entity', 1),
- ), t('Test sort entity revision_id property in descending order.'), TRUE);
+ ), 'Test sort entity revision_id property in descending order.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -403,7 +403,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), t('Test sort field in ascending order without field condition.'), TRUE);
+ ), 'Test sort field in ascending order without field condition.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -414,7 +414,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 1),
- ), t('Test sort field in descending order without field condition.'), TRUE);
+ ), 'Test sort field in descending order without field condition.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -426,7 +426,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), t('Test sort field in ascending order.'), TRUE);
+ ), 'Test sort field in ascending order.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -438,7 +438,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 1),
- ), t('Test sort field in descending order.'), TRUE);
+ ), 'Test sort field in descending order.', TRUE);
// Test "in" operation with entity entity_type condition and entity_id
// property condition.
@@ -450,7 +450,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 1),
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), t('Test "in" operation with entity entity_type condition and entity_id property condition.'));
+ ), 'Test "in" operation with entity entity_type condition and entity_id property condition.');
// Test "in" operation with entity entity_type condition and entity_id
// property condition. Sort in descending order by entity_id.
@@ -463,7 +463,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 1),
- ), t('Test "in" operation with entity entity_type condition and entity_id property condition. Sort entity_id in descending order.'), TRUE);
+ ), 'Test "in" operation with entity entity_type condition and entity_id property condition. Sort entity_id in descending order.', TRUE);
// Test query count
$query = new EntityFieldQuery();
@@ -471,7 +471,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->entityCondition('entity_type', 'test_entity_bundle_key')
->count()
->execute();
- $this->assertEqual($query_count, 6, t('Test query count on entity condition.'));
+ $this->assertEqual($query_count, 6, 'Test query count on entity condition.');
$query = new EntityFieldQuery();
$query_count = $query
@@ -479,7 +479,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', '1')
->count()
->execute();
- $this->assertEqual($query_count, 1, t('Test query count on entity and property condition.'));
+ $this->assertEqual($query_count, 1, 'Test query count on entity and property condition.');
$query = new EntityFieldQuery();
$query_count = $query
@@ -487,7 +487,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', '4', '>')
->count()
->execute();
- $this->assertEqual($query_count, 2, t('Test query count on entity and property condition with operator.'));
+ $this->assertEqual($query_count, 2, 'Test query count on entity and property condition with operator.');
$query = new EntityFieldQuery();
$query_count = $query
@@ -495,7 +495,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->fieldCondition($this->fields[0], 'value', 3, '=')
->count()
->execute();
- $this->assertEqual($query_count, 1, t('Test query count on field condition.'));
+ $this->assertEqual($query_count, 1, 'Test query count on field condition.');
// First, test without options.
$query = new EntityFieldQuery();
@@ -504,14 +504,14 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', 1, 'CONTAINS');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
- ), t('Test the "contains" operation on a property.'));
+ ), 'Test the "contains" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 3, 'CONTAINS');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
array('test_entity', 3),
- ), t('Test the "contains" operation on a field.'));
+ ), 'Test the "contains" operation on a field.');
$query = new EntityFieldQuery();
$query
@@ -519,14 +519,14 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', 1, '=');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
- ), t('Test the "equal to" operation on a property.'));
+ ), 'Test the "equal to" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 3, '=');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
array('test_entity', 3),
- ), t('Test the "equal to" operation on a field.'));
+ ), 'Test the "equal to" operation on a field.');
$query = new EntityFieldQuery();
$query
@@ -538,7 +538,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test the "not equal to" operation on a property.'));
+ ), 'Test the "not equal to" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 3, '!=');
@@ -549,7 +549,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 1),
array('test_entity', 2),
array('test_entity', 4),
- ), t('Test the "not equal to" operation on a field.'));
+ ), 'Test the "not equal to" operation on a field.');
$query = new EntityFieldQuery();
$query
@@ -557,14 +557,14 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->propertyCondition('ftid', 2, '<');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
- ), t('Test the "less than" operation on a property.'));
+ ), 'Test the "less than" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 2, '<');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
array('test_entity', 1),
- ), t('Test the "less than" operation on a field.'));
+ ), 'Test the "less than" operation on a field.');
$query = new EntityFieldQuery();
$query
@@ -573,7 +573,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
array('test_entity_bundle_key', 2),
- ), t('Test the "less than or equal to" operation on a property.'));
+ ), 'Test the "less than or equal to" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 2, '<=');
@@ -582,7 +582,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity', 1),
array('test_entity', 2),
- ), t('Test the "less than or equal to" operation on a field.'));
+ ), 'Test the "less than or equal to" operation on a field.');
$query = new EntityFieldQuery();
$query
@@ -591,7 +591,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test the "greater than" operation on a property.'));
+ ), 'Test the "greater than" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 2, '>');
@@ -600,7 +600,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity', 3),
array('test_entity', 4),
- ), t('Test the "greater than" operation on a field.'));
+ ), 'Test the "greater than" operation on a field.');
$query = new EntityFieldQuery();
$query
@@ -610,7 +610,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test the "greater than or equal to" operation on a property.'));
+ ), 'Test the "greater than or equal to" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 3, '>=');
@@ -619,7 +619,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity', 3),
array('test_entity', 4),
- ), t('Test the "greater than or equal to" operation on a field.'));
+ ), 'Test the "greater than or equal to" operation on a field.');
$query = new EntityFieldQuery();
$query
@@ -630,7 +630,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test the "not in" operation on a property.'));
+ ), 'Test the "not in" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', array(3, 4, 100, 101), 'NOT IN');
@@ -639,7 +639,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 2),
array('test_entity', 1),
array('test_entity', 2),
- ), t('Test the "not in" operation on a field.'));
+ ), 'Test the "not in" operation on a field.');
$query = new EntityFieldQuery();
$query
@@ -648,7 +648,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), t('Test the "in" operation on a property.'));
+ ), 'Test the "in" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', array(2, 3), 'IN');
@@ -657,7 +657,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity', 2),
array('test_entity', 3),
- ), t('Test the "in" operation on a field.'));
+ ), 'Test the "in" operation on a field.');
$query = new EntityFieldQuery();
$query
@@ -667,7 +667,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 1),
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 3),
- ), t('Test the "between" operation on a property.'));
+ ), 'Test the "between" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', array(1, 3), 'BETWEEN');
@@ -678,7 +678,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 1),
array('test_entity', 2),
array('test_entity', 3),
- ), t('Test the "between" operation on a field.'));
+ ), 'Test the "between" operation on a field.');
$query = new EntityFieldQuery();
$query
@@ -691,20 +691,20 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 4),
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test the "starts_with" operation on a property.'));
+ ), 'Test the "starts_with" operation on a property.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[1], 'shape', 'squ', 'STARTS_WITH');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle', 5),
- ), t('Test the "starts_with" operation on a field.'));
+ ), 'Test the "starts_with" operation on a field.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', 3);
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
array('test_entity', 3),
- ), t('Test omission of an operator with a single item.'));
+ ), 'Test omission of an operator with a single item.');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', array(2, 3));
@@ -713,7 +713,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity', 2),
array('test_entity', 3),
- ), t('Test omission of an operator with multiple items.'));
+ ), 'Test omission of an operator with multiple items.');
$query = new EntityFieldQuery();
$query
@@ -723,7 +723,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 2),
array('test_entity_bundle_key', 3),
- ), t('Test entity, property and field conditions.'));
+ ), 'Test entity, property and field conditions.');
$query = new EntityFieldQuery();
$query
@@ -733,7 +733,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->fieldCondition($this->fields[0], 'value', 4);
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 4),
- ), t('Test entity condition with "starts_with" operation, and property and field conditions.'));
+ ), 'Test entity condition with "starts_with" operation, and property and field conditions.');
$query = new EntityFieldQuery();
$query
@@ -743,7 +743,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
array('test_entity_bundle_key', 2),
- ), t('Test limit on a property.'), TRUE);
+ ), 'Test limit on a property.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -754,7 +754,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 1),
array('test_entity_bundle_key', 2),
- ), t('Test limit on a field.'), TRUE);
+ ), 'Test limit on a field.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -764,7 +764,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 5),
array('test_entity_bundle_key', 6),
- ), t('Test offset on a property.'), TRUE);
+ ), 'Test offset on a property.', TRUE);
$query = new EntityFieldQuery();
$query
@@ -775,7 +775,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle_key', 3),
array('test_entity_bundle_key', 4),
- ), t('Test offset on a field.'), TRUE);
+ ), 'Test offset on a field.', TRUE);
for ($i = 6; $i < 10; $i++) {
$entity = new stdClass();
@@ -794,7 +794,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity', 4),
array('test_entity_bundle', 8),
array('test_entity_bundle', 9),
- ), t('Select a field across multiple entities.'));
+ ), 'Select a field across multiple entities.');
$query = new EntityFieldQuery();
$query
@@ -802,13 +802,13 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
->fieldCondition($this->fields[1], 'color', 'blue');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle', 5),
- ), t('Test without a delta group.'));
+ ), 'Test without a delta group.');
$query = new EntityFieldQuery();
$query
->fieldCondition($this->fields[1], 'shape', 'square', '=', 'group')
->fieldCondition($this->fields[1], 'color', 'blue', '=', 'group');
- $this->assertEntityFieldQuery($query, array(), t('Test with a delta group.'));
+ $this->assertEntityFieldQuery($query, array(), 'Test with a delta group.');
// Test query on a deleted field.
field_attach_delete_bundle('test_entity_bundle_key', 'bundle1');
@@ -817,12 +817,12 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$query->fieldCondition($this->fields[0], 'value', '3');
$this->assertEntityFieldQuery($query, array(
array('test_entity_bundle', 8),
- ), t('Test query on a field after deleting field from some entities.'));
+ ), 'Test query on a field after deleting field from some entities.');
field_attach_delete_bundle('test_entity_bundle', 'test_entity_bundle');
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', '3');
- $this->assertEntityFieldQuery($query, array(), t('Test query on a field after deleting field from all entities.'));
+ $this->assertEntityFieldQuery($query, array(), 'Test query on a field after deleting field from all entities.');
$query = new EntityFieldQuery();
$query
@@ -832,7 +832,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
array('test_entity_bundle_key', 3),
array('test_entity_bundle', 8),
array('test_entity', 3),
- ), t('Test query on a deleted field with deleted option set to TRUE.'));
+ ), 'Test query on a deleted field with deleted option set to TRUE.');
$pass = FALSE;
$query = new EntityFieldQuery();
@@ -842,7 +842,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
catch (EntityFieldQueryException $exception) {
$pass = ($exception->getMessage() == t('For this query an entity type must be specified.'));
}
- $this->assertTrue($pass, t("Can't query the universe."));
+ $this->assertTrue($pass, "Can't query the universe.");
}
/**
@@ -852,19 +852,19 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
// Entity-only query.
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'test_entity_bundle_key');
- $this->assertIdentical($query->queryCallback(), array($query, 'propertyQuery'), t('Entity-only queries are handled by the propertyQuery handler.'));
+ $this->assertIdentical($query->queryCallback(), array($query, 'propertyQuery'), 'Entity-only queries are handled by the propertyQuery handler.');
// Field-only query.
$query = new EntityFieldQuery();
$query->fieldCondition($this->fields[0], 'value', '3');
- $this->assertIdentical($query->queryCallback(), 'field_sql_storage_field_storage_query', t('Pure field queries are handled by the Field storage handler.'));
+ $this->assertIdentical($query->queryCallback(), 'field_sql_storage_field_storage_query', 'Pure field queries are handled by the Field storage handler.');
// Mixed entity and field query.
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'test_entity_bundle_key')
->fieldCondition($this->fields[0], 'value', '3');
- $this->assertIdentical($query->queryCallback(), 'field_sql_storage_field_storage_query', t('Mixed queries are handled by the Field storage handler.'));
+ $this->assertIdentical($query->queryCallback(), 'field_sql_storage_field_storage_query', 'Mixed queries are handled by the Field storage handler.');
// Overriding with $query->executeCallback.
$query = new EntityFieldQuery();
@@ -872,7 +872,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$query->executeCallback = 'field_test_dummy_field_storage_query';
$this->assertEntityFieldQuery($query, array(
array('user', 1),
- ), t('executeCallback can override the query handler.'));
+ ), 'executeCallback can override the query handler.');
// Overriding with $query->executeCallback via hook_entity_query_alter().
$query = new EntityFieldQuery();
@@ -881,7 +881,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
$query->alterMyExecuteCallbackPlease = TRUE;
$this->assertEntityFieldQuery($query, array(
array('user', 1),
- ), t('executeCallback can override the query handler when set in a hook_entity_query_alter().'));
+ ), 'executeCallback can override the query handler when set in a hook_entity_query_alter().');
// Mixed-storage queries.
$query = new EntityFieldQuery();
@@ -896,7 +896,7 @@ class EntityFieldQueryTestCase extends DrupalWebTestCase {
catch (EntityFieldQueryException $exception) {
$pass = ($exception->getMessage() == t("Can't handle more than one field storage engine"));
}
- $this->assertTrue($pass, t('Cannot query across field storage engines.'));
+ $this->assertTrue($pass, 'Cannot query across field storage engines.');
}
/**
diff --git a/modules/simpletest/tests/error.test b/modules/simpletest/tests/error.test
index fe4ee4526..cd648e12b 100644
--- a/modules/simpletest/tests/error.test
+++ b/modules/simpletest/tests/error.test
@@ -46,7 +46,7 @@ class DrupalErrorHandlerUnitTest 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);
@@ -54,7 +54,7 @@ class DrupalErrorHandlerUnitTest 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);
@@ -62,7 +62,7 @@ class DrupalErrorHandlerUnitTest 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);
@@ -88,17 +88,17 @@ class DrupalErrorHandlerUnitTest 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));
+ $this->assertText($error_pdo_exception['%type'], 'Found ' . $error_pdo_exception['%type'] . ' in error page.');
+ $this->assertText($error_pdo_exception['%message'], 'Found ' . $error_pdo_exception['%message'] . ' in error page.');
$error_details = t('in %function (line %line of %file)', $error_pdo_exception);
- $this->assertRaw($error_details, t("Found '!message' in error page.", array('!message' => $error_details)));
+ $this->assertRaw($error_details, "Found '" . $error_details . "' in error page.");
}
/**
@@ -106,7 +106,7 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase {
*/
function assertErrorMessage(array $error) {
$message = t('%type: %message in %function (line %line of %file).', $error);
- $this->assertRaw($message, t('Error !message found.', array('!message' => $message)));
+ $this->assertRaw($message, 'Error ' . $message . ' found.');
}
/**
@@ -114,7 +114,7 @@ class DrupalErrorHandlerUnitTest extends DrupalWebTestCase {
*/
function assertNoErrorMessage(array $error) {
$message = t('%type: %message in %function (line %line of %file).', $error);
- $this->assertNoRaw($message, t('Error !message not found.', array('!message' => $message)));
+ $this->assertNoRaw($message, 'Error ' . $message . ' not found.');
}
}
diff --git a/modules/simpletest/tests/file.test b/modules/simpletest/tests/file.test
index 4cfdad807..268cd24d8 100644
--- a/modules/simpletest/tests/file.test
+++ b/modules/simpletest/tests/file.test
@@ -58,13 +58,13 @@ class FileTestCase extends DrupalWebTestCase {
* File object to compare.
*/
function assertFileUnchanged($before, $after) {
- $this->assertEqual($before->fid, $after->fid, t('File id is the same: %file1 == %file2.', array('%file1' => $before->fid, '%file2' => $after->fid)), 'File unchanged');
- $this->assertEqual($before->uid, $after->uid, t('File owner is the same: %file1 == %file2.', array('%file1' => $before->uid, '%file2' => $after->uid)), 'File unchanged');
- $this->assertEqual($before->filename, $after->filename, t('File name is the same: %file1 == %file2.', array('%file1' => $before->filename, '%file2' => $after->filename)), 'File unchanged');
- $this->assertEqual($before->uri, $after->uri, t('File path is the same: %file1 == %file2.', array('%file1' => $before->uri, '%file2' => $after->uri)), 'File unchanged');
- $this->assertEqual($before->filemime, $after->filemime, t('File MIME type is the same: %file1 == %file2.', array('%file1' => $before->filemime, '%file2' => $after->filemime)), 'File unchanged');
- $this->assertEqual($before->filesize, $after->filesize, t('File size is the same: %file1 == %file2.', array('%file1' => $before->filesize, '%file2' => $after->filesize)), 'File unchanged');
- $this->assertEqual($before->status, $after->status, t('File status is the same: %file1 == %file2.', array('%file1' => $before->status, '%file2' => $after->status)), 'File unchanged');
+ $this->assertEqual($before->fid, $after->fid, 'File id is the same: ' . $before->fid . ' == ' . $after->fid . '.', 'File unchanged');
+ $this->assertEqual($before->uid, $after->uid, 'File owner is the same: ' . $before->uid . ' == ' . $after->uid . '.', 'File unchanged');
+ $this->assertEqual($before->filename, $after->filename, 'File name is the same: ' . $before->filename . ' == ' . $after->filename . '.', 'File unchanged');
+ $this->assertEqual($before->uri, $after->uri, 'File path is the same: ' . $before->uri . ' == ' . $after->uri . '.', 'File unchanged');
+ $this->assertEqual($before->filemime, $after->filemime, 'File MIME type is the same: ' . $before->filemime . ' == ' . $after->filemime . '.', 'File unchanged');
+ $this->assertEqual($before->filesize, $after->filesize, 'File size is the same: ' . $before->filesize . ' == ' . $after->filesize . '.', 'File unchanged');
+ $this->assertEqual($before->status, $after->status, 'File status is the same: ' . $before->status . ' == ' . $after->status . '.', 'File unchanged');
}
/**
@@ -76,8 +76,8 @@ class FileTestCase extends DrupalWebTestCase {
* File object to compare.
*/
function assertDifferentFile($file1, $file2) {
- $this->assertNotEqual($file1->fid, $file2->fid, t('Files have different ids: %file1 != %file2.', array('%file1' => $file1->fid, '%file2' => $file2->fid)), 'Different file');
- $this->assertNotEqual($file1->uri, $file2->uri, t('Files have different paths: %file1 != %file2.', array('%file1' => $file1->uri, '%file2' => $file2->uri)), 'Different file');
+ $this->assertNotEqual($file1->fid, $file2->fid, 'Files have different ids: ' . $file1->fid . ' != ' . $file2->fid . '.', 'Different file');
+ $this->assertNotEqual($file1->uri, $file2->uri, 'Files have different paths: ' . $file1->uri . ' != ' . $file2->uri . '.', 'Different file');
}
/**
@@ -89,8 +89,8 @@ class FileTestCase extends DrupalWebTestCase {
* File object to compare.
*/
function assertSameFile($file1, $file2) {
- $this->assertEqual($file1->fid, $file2->fid, t('Files have the same ids: %file1 == %file2.', array('%file1' => $file1->fid, '%file2-fid' => $file2->fid)), 'Same file');
- $this->assertEqual($file1->uri, $file2->uri, t('Files have the same path: %file1 == %file2.', array('%file1' => $file1->uri, '%file2' => $file2->uri)), 'Same file');
+ $this->assertEqual($file1->fid, $file2->fid, 'Files have the same ids: ' . $file1->fid . ' == %file2.', 'Same file');
+ $this->assertEqual($file1->uri, $file2->uri, 'Files have the same path: ' . $file1->uri . ' == ' . $file2->uri . '.', 'Same file');
}
/**
@@ -151,7 +151,7 @@ class FileTestCase extends DrupalWebTestCase {
if (is_null($path)) {
$path = file_directory_path() . '/' . $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;
}
@@ -182,7 +182,7 @@ class FileTestCase extends DrupalWebTestCase {
}
file_put_contents($filepath, $contents);
- $this->assertTrue(is_file($filepath), t('The test file exists on the disk.'), 'Create test file');
+ $this->assertTrue(is_file($filepath), 'The test file exists on the disk.', 'Create test file');
$file = new stdClass();
$file->uri = $filepath;
@@ -194,7 +194,7 @@ class FileTestCase extends DrupalWebTestCase {
$file->status = 0;
// Write the record directly rather than calling file_save() so we don't
// invoke the hooks.
- $this->assertNotIdentical(drupal_write_record('file_managed', $file), FALSE, t('The file was added to the database.'), 'Create test file');
+ $this->assertNotIdentical(drupal_write_record('file_managed', $file), FALSE, 'The file was added to the database.', 'Create test file');
return $file;
}
@@ -227,19 +227,19 @@ class FileHookTestCase extends FileTestCase {
// Determine if there were any expected that were not called.
$uncalled = array_diff($expected, $actual);
if (count($uncalled)) {
- $this->assertTrue(FALSE, t('Expected hooks %expected to be called but %uncalled was not called.', array('%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled))));
+ $this->assertTrue(FALSE, 'Expected hooks ' . implode(', ', $expected) . ' to be called but ' . implode(', ', $uncalled) . ' was not called.');
}
else {
- $this->assertTrue(TRUE, t('All the expected hooks were called: %expected', array('%expected' => implode(', ', $expected))));
+ $this->assertTrue(TRUE, 'All the expected hooks were called: ' . implode(', ', $expected));
}
// Determine if there were any unexpected calls.
$unexpected = array_diff($actual, $expected);
if (count($unexpected)) {
- $this->assertTrue(FALSE, t('Unexpected hooks were called: %unexpected.', array('%unexpected' => implode(', ', $unexpected))));
+ $this->assertTrue(FALSE, 'Unexpected hooks were called: ' . implode(', ', $unexpected) . '.');
}
else {
- $this->assertTrue(TRUE, t('No unexpected hooks were called.'));
+ $this->assertTrue(TRUE, 'No unexpected hooks were called.');
}
}
@@ -358,24 +358,24 @@ class FileValidatorTest extends DrupalWebTestCase {
$file = new stdClass();
$file->filename = 'asdf.txt';
$errors = file_validate_extensions($file, 'asdf txt pork');
- $this->assertEqual(count($errors), 0, t('Valid extension accepted.'), 'File');
+ $this->assertEqual(count($errors), 0, 'Valid extension accepted.', 'File');
$file->filename = 'asdf.txt';
$errors = file_validate_extensions($file, 'exe png');
- $this->assertEqual(count($errors), 1, t('Invalid extension blocked.'), 'File');
+ $this->assertEqual(count($errors), 1, 'Invalid extension blocked.', 'File');
}
/**
* This ensures a specific file is actually an image.
*/
function testFileValidateIsImage() {
- $this->assertTrue(file_exists($this->image->uri), t('The image being tested exists.'), 'File');
+ $this->assertTrue(file_exists($this->image->uri), 'The image being tested exists.', 'File');
$errors = file_validate_is_image($this->image);
- $this->assertEqual(count($errors), 0, t('No error reported for our image file.'), 'File');
+ $this->assertEqual(count($errors), 0, 'No error reported for our image file.', 'File');
- $this->assertTrue(file_exists($this->non_image->uri), t('The non-image being tested exists.'), 'File');
+ $this->assertTrue(file_exists($this->non_image->uri), 'The non-image being tested exists.', 'File');
$errors = file_validate_is_image($this->non_image);
- $this->assertEqual(count($errors), 1, t('An error reported for our non-image file.'), 'File');
+ $this->assertEqual(count($errors), 1, 'An error reported for our non-image file.', 'File');
}
/**
@@ -385,19 +385,19 @@ class FileValidatorTest extends DrupalWebTestCase {
function testFileValidateImageResolution() {
// Non-images.
$errors = file_validate_image_resolution($this->non_image);
- $this->assertEqual(count($errors), 0, t("Shouldn't get any errors for a non-image file."), 'File');
+ $this->assertEqual(count($errors), 0, "Shouldn't get any errors for a non-image file.", 'File');
$errors = file_validate_image_resolution($this->non_image, '50x50', '100x100');
- $this->assertEqual(count($errors), 0, t("Don't check the resolution on non files."), 'File');
+ $this->assertEqual(count($errors), 0, "Don't check the resolution on non files.", 'File');
// Minimum size.
$errors = file_validate_image_resolution($this->image);
- $this->assertEqual(count($errors), 0, t('No errors for an image when there is no minimum or maximum resolution.'), 'File');
+ $this->assertEqual(count($errors), 0, 'No errors for an image when there is no minimum or maximum resolution.', 'File');
$errors = file_validate_image_resolution($this->image, 0, '200x1');
- $this->assertEqual(count($errors), 1, t("Got an error for an image that wasn't wide enough."), 'File');
+ $this->assertEqual(count($errors), 1, "Got an error for an image that wasn't wide enough.", 'File');
$errors = file_validate_image_resolution($this->image, 0, '1x200');
- $this->assertEqual(count($errors), 1, t("Got an error for an image that wasn't tall enough."), 'File');
+ $this->assertEqual(count($errors), 1, "Got an error for an image that wasn't tall enough.", 'File');
$errors = file_validate_image_resolution($this->image, 0, '200x200');
- $this->assertEqual(count($errors), 1, t('Small images report an error.'), 'File');
+ $this->assertEqual(count($errors), 1, 'Small images report an error.', 'File');
// Maximum size.
if (image_get_toolkit()) {
@@ -407,18 +407,18 @@ class FileValidatorTest extends DrupalWebTestCase {
$this->image->uri = $temp_dir . '/druplicon.png';
$errors = file_validate_image_resolution($this->image, '10x5');
- $this->assertEqual(count($errors), 0, t('No errors should be reported when an oversized image can be scaled down.'), 'File');
+ $this->assertEqual(count($errors), 0, 'No errors should be reported when an oversized image can be scaled down.', 'File');
$info = image_get_info($this->image->uri);
- $this->assertTrue($info['width'] <= 10, t('Image scaled to correct width.'), 'File');
- $this->assertTrue($info['height'] <= 5, t('Image scaled to correct height.'), 'File');
+ $this->assertTrue($info['width'] <= 10, 'Image scaled to correct width.', 'File');
+ $this->assertTrue($info['height'] <= 5, 'Image scaled to correct height.', 'File');
unlink(drupal_realpath($temp_dir . '/druplicon.png'));
}
else {
// TODO: should check that the error is returned if no toolkit is available.
$errors = file_validate_image_resolution($this->image, '5x10');
- $this->assertEqual(count($errors), 1, t("Oversize images that can't be scaled get an error."), 'File');
+ $this->assertEqual(count($errors), 1, "Oversize images that can't be scaled get an error.", 'File');
}
}
@@ -433,17 +433,17 @@ class FileValidatorTest extends DrupalWebTestCase {
$file->filename = str_repeat('x', 240);
$this->assertEqual(strlen($file->filename), 240);
$errors = file_validate_name_length($file);
- $this->assertEqual(count($errors), 0, t('No errors reported for 240 length filename.'), 'File');
+ $this->assertEqual(count($errors), 0, 'No errors reported for 240 length filename.', 'File');
// Add a filename with a length too long and test it.
$file->filename = str_repeat('x', 241);
$errors = file_validate_name_length($file);
- $this->assertEqual(count($errors), 1, t('An error reported for 241 length filename.'), 'File');
+ $this->assertEqual(count($errors), 1, 'An error reported for 241 length filename.', 'File');
// Add a filename with an empty string and test it.
$file->filename = '';
$errors = file_validate_name_length($file);
- $this->assertEqual(count($errors), 1, t('An error reported for 0 length filename.'), 'File');
+ $this->assertEqual(count($errors), 1, 'An error reported for 0 length filename.', 'File');
}
@@ -461,7 +461,7 @@ class FileValidatorTest extends DrupalWebTestCase {
$file = new stdClass();
$file->filesize = 999999;
$errors = file_validate_size($file, 1, 1);
- $this->assertEqual(count($errors), 0, t('No size limits enforced on uid=1.'), 'File');
+ $this->assertEqual(count($errors), 0, 'No size limits enforced on uid=1.', 'File');
// Run these tests as a regular user.
$user = $this->drupalCreateUser();
@@ -470,13 +470,13 @@ class FileValidatorTest extends DrupalWebTestCase {
$file = new stdClass();
$file->filesize = 1000;
$errors = file_validate_size($file, 0, 0);
- $this->assertEqual(count($errors), 0, t('No limits means no errors.'), 'File');
+ $this->assertEqual(count($errors), 0, 'No limits means no errors.', 'File');
$errors = file_validate_size($file, 1, 0);
- $this->assertEqual(count($errors), 1, t('Error for the file being over the limit.'), 'File');
+ $this->assertEqual(count($errors), 1, 'Error for the file being over the limit.', 'File');
$errors = file_validate_size($file, 0, 1);
- $this->assertEqual(count($errors), 1, t('Error for the user being over their limit.'), 'File');
+ $this->assertEqual(count($errors), 1, 'Error for the user being over their limit.', 'File');
$errors = file_validate_size($file, 1, 1);
- $this->assertEqual(count($errors), 2, t('Errors for both the file and their limit.'), 'File');
+ $this->assertEqual(count($errors), 2, 'Errors for both the file and their limit.', 'File');
$user = $original_user;
drupal_save_session(TRUE);
@@ -505,16 +505,16 @@ class FileUnmanagedSaveDataTest extends FileTestCase {
// No filename.
$filepath = file_unmanaged_save_data($contents);
- $this->assertTrue($filepath, t('Unnamed file saved correctly.'));
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($filepath)), t("File was placed in Drupal's files directory."));
- $this->assertEqual($contents, file_get_contents(drupal_realpath($filepath)), t('Contents of the file are correct.'));
+ $this->assertTrue($filepath, 'Unnamed file saved correctly.');
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($filepath)), "File was placed in Drupal's files directory.");
+ $this->assertEqual($contents, file_get_contents(drupal_realpath($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(file_directory_path('public'), file_directory_path(file_uri_scheme($filepath)), t("File was placed in Drupal's files directory."));
- $this->assertEqual('asdf.txt', basename($filepath), t('File was named correctly.'));
- $this->assertEqual($contents, file_get_contents(drupal_realpath($filepath)), t('Contents of the file are correct.'));
+ $this->assertTrue($filepath, 'Unnamed file saved correctly.');
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_uri_scheme($filepath)), "File was placed in Drupal's files directory.");
+ $this->assertEqual('asdf.txt', basename($filepath), 'File was named correctly.');
+ $this->assertEqual($contents, file_get_contents(drupal_realpath($filepath)), 'Contents of the file are correct.');
$this->assertFilePermissions($filepath, variable_get('file_chmod_file', 0664));
}
}
@@ -553,10 +553,10 @@ class FileSaveUploadTest extends FileHookTestCase {
$this->image = current($this->drupalGetTestFiles('image'));
list(, $this->image_extension) = explode('.', $this->image->filename);
- $this->assertTrue(is_file($this->image->uri), t("The image file we're going to upload exists."));
+ $this->assertTrue(is_file($this->image->uri), "The image file we're going to upload exists.");
$this->phpfile = current($this->drupalGetTestFiles('php'));
- $this->assertTrue(is_file($this->phpfile->uri), t("The PHP file we're going to upload exists."));
+ $this->assertTrue(is_file($this->phpfile->uri), "The PHP file we're going to upload exists.");
$this->maxFidBefore = db_query('SELECT MAX(fid) AS fid FROM {file_managed}')->fetchField();
@@ -566,8 +566,8 @@ class FileSaveUploadTest extends FileHookTestCase {
'files[file_test_upload]' => drupal_realpath($this->image->uri),
);
$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!'), t('Found the success message.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called then clean out the hook
// counters.
@@ -580,9 +580,9 @@ class FileSaveUploadTest extends FileHookTestCase {
*/
function testNormal() {
$max_fid_after = db_query('SELECT MAX(fid) AS fid FROM {file_managed}')->fetchField();
- $this->assertTrue($max_fid_after > $this->maxFidBefore, t('A new file was created.'));
+ $this->assertTrue($max_fid_after > $this->maxFidBefore, 'A new file was created.');
$file1 = file_load($max_fid_after);
- $this->assertTrue($file1, t('Loaded the file.'));
+ $this->assertTrue($file1, 'Loaded the file.');
// MIME type of the uploaded image may be either image/jpeg or image/png.
$this->assertEqual(substr($file1->filemime, 0, 5), 'image', 'A MIME type was set.');
@@ -594,7 +594,7 @@ class FileSaveUploadTest extends FileHookTestCase {
$image2 = current($this->drupalGetTestFiles('image'));
$edit = array('files[file_test_upload]' => drupal_realpath($image2->uri));
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
$this->assertRaw(t('You WIN!'));
$max_fid_after = db_query('SELECT MAX(fid) AS fid FROM {file_managed}')->fetchField();
@@ -608,8 +608,8 @@ class FileSaveUploadTest extends FileHookTestCase {
// Load both files using file_load_multiple().
$files = file_load_multiple(array($file1->fid, $file2->fid));
- $this->assertTrue(isset($files[$file1->fid]), t('File was loaded successfully'));
- $this->assertTrue(isset($files[$file2->fid]), t('File was loaded successfully'));
+ $this->assertTrue(isset($files[$file1->fid]), 'File was loaded successfully');
+ $this->assertTrue(isset($files[$file2->fid]), 'File was loaded successfully');
// Upload a third file to a subdirectory.
$image3 = current($this->drupalGetTestFiles('image'));
@@ -620,12 +620,12 @@ class FileSaveUploadTest extends FileHookTestCase {
'file_subdir' => $dir,
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
$this->assertRaw(t('You WIN!'));
$this->assertTrue(is_file('temporary://' . $dir . '/' . trim(basename($image3_realpath))));
// Check that file_load_multiple() with no arguments returns FALSE.
- $this->assertFalse(file_load_multiple(), t('No files were loaded.'));
+ $this->assertFalse(file_load_multiple(), 'No files were loaded.');
}
/**
@@ -644,10 +644,10 @@ class FileSaveUploadTest extends FileHookTestCase {
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
$message = t('Only files with the following extensions are allowed: ') . '<em class="placeholder">' . $extensions . '</em>';
- $this->assertRaw($message, t('Can\'t upload a disallowed extension'));
- $this->assertRaw(t('Epic upload FAIL!'), t('Found the failure message.'));
+ $this->assertRaw($message, 'Can\'t upload a disallowed extension');
+ $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate'));
@@ -664,9 +664,9 @@ class FileSaveUploadTest extends FileHookTestCase {
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, t('Received a 200 response for posted test file.'));
- $this->assertNoRaw(t('Only files with the following extensions are allowed:'), t('Can upload an allowed extension.'));
- $this->assertRaw(t('You WIN!'), t('Found the success message.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload an allowed extension.');
+ $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'load', 'update'));
@@ -681,9 +681,9 @@ class FileSaveUploadTest extends FileHookTestCase {
'allow_all_extensions' => TRUE,
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, t('Received a 200 response for posted test file.'));
- $this->assertNoRaw(t('Only files with the following extensions are allowed:'), t('Can upload any extension.'));
- $this->assertRaw(t('You WIN!'), t('Found the success message.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertNoRaw(t('Only files with the following extensions are allowed:'), 'Can upload any extension.');
+ $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'load', 'update'));
@@ -703,11 +703,11 @@ class FileSaveUploadTest extends FileHookTestCase {
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, t('Received a 200 response for posted test file.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
$message = t('For security reasons, your upload has been renamed to ') . '<em class="placeholder">' . $this->phpfile->filename . '.txt' . '</em>';
- $this->assertRaw($message, t('Dangerous file was renamed.'));
- $this->assertRaw(t('File MIME type is text/plain.'), t('Dangerous file\'s MIME type was changed.'));
- $this->assertRaw(t('You WIN!'), t('Found the success message.'));
+ $this->assertRaw($message, 'Dangerous file was renamed.');
+ $this->assertRaw(t('File MIME type is text/plain.'), 'Dangerous file\'s MIME type was changed.');
+ $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'insert'));
@@ -719,10 +719,10 @@ class FileSaveUploadTest extends FileHookTestCase {
file_test_reset();
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, t('Received a 200 response for posted test file.'));
- $this->assertNoRaw(t('For security reasons, your upload has been renamed'), t('Found no security message.'));
- $this->assertRaw(t('File name is !filename', array('!filename' => $this->phpfile->filename)), t('Dangerous file was not renamed when insecure uploads is TRUE.'));
- $this->assertRaw(t('You WIN!'), t('Found the success message.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.');
+ $this->assertRaw(t('File name is !filename', array('!filename' => $this->phpfile->filename)), 'Dangerous file was not renamed when insecure uploads is TRUE.');
+ $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'insert'));
@@ -753,10 +753,10 @@ class FileSaveUploadTest extends FileHookTestCase {
$munged_filename .= '_.' . $this->image_extension;
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, t('Received a 200 response for posted test file.'));
- $this->assertRaw(t('For security reasons, your upload has been renamed'), t('Found security message.'));
- $this->assertRaw(t('File name is !filename', array('!filename' => $munged_filename)), t('File was successfully munged.'));
- $this->assertRaw(t('You WIN!'), t('Found the success message.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertRaw(t('For security reasons, your upload has been renamed'), 'Found security message.');
+ $this->assertRaw(t('File name is !filename', array('!filename' => $munged_filename)), 'File was successfully munged.');
+ $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'insert'));
@@ -771,10 +771,10 @@ class FileSaveUploadTest extends FileHookTestCase {
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, t('Received a 200 response for posted test file.'));
- $this->assertNoRaw(t('For security reasons, your upload has been renamed'), t('Found no security message.'));
- $this->assertRaw(t('File name is !filename', array('!filename' => $this->image->filename)), t('File was not munged when allowing any extension.'));
- $this->assertRaw(t('You WIN!'), t('Found the success message.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertNoRaw(t('For security reasons, your upload has been renamed'), 'Found no security message.');
+ $this->assertRaw(t('File name is !filename', array('!filename' => $this->image->filename)), 'File was not munged when allowing any extension.');
+ $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'insert'));
@@ -789,8 +789,8 @@ class FileSaveUploadTest extends FileHookTestCase {
'files[file_test_upload]' => drupal_realpath($this->image->uri)
);
$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!'), t('Found the success message.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'insert'));
@@ -805,8 +805,8 @@ class FileSaveUploadTest extends FileHookTestCase {
'files[file_test_upload]' => drupal_realpath($this->image->uri)
);
$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!'), t('Found the success message.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertRaw(t('You WIN!'), 'Found the success message.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('validate', 'load', 'update'));
@@ -821,8 +821,8 @@ class FileSaveUploadTest extends FileHookTestCase {
'files[file_test_upload]' => drupal_realpath($this->image->uri)
);
$this->drupalPost('file-test/upload', $edit, t('Submit'));
- $this->assertResponse(200, t('Received a 200 response for posted test file.'));
- $this->assertRaw(t('Epic upload FAIL!'), t('Found the failure message.'));
+ $this->assertResponse(200, 'Received a 200 response for posted test file.');
+ $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
// Check that the no hooks were called while failing.
$this->assertFileHooksCalled(array());
@@ -833,7 +833,7 @@ class FileSaveUploadTest extends FileHookTestCase {
*/
function testNoUpload() {
$this->drupalPost('file-test/upload', array(), t('Submit'));
- $this->assertNoRaw(t('Epic upload FAIL!'), t('Failure message not found.'));
+ $this->assertNoRaw(t('Epic upload FAIL!'), 'Failure message not found.');
}
}
@@ -855,23 +855,23 @@ class FileDirectoryTest extends FileTestCase {
function testFileCheckDirectory() {
// A directory to operate on.
$directory = file_directory_path() . '/' . $this->randomName() . '/' . $this->randomName();
- $this->assertFalse(is_dir($directory), t('Directory does not exist prior to testing.'));
+ $this->assertFalse(is_dir($directory), 'Directory does not exist prior to testing.');
// Non-existent directory.
- $this->assertFalse(file_prepare_directory($directory, 0), t('Error reported for non-existing directory.'), 'File');
+ $this->assertFalse(file_prepare_directory($directory, 0), 'Error reported for non-existing directory.', 'File');
// Make a directory.
- $this->assertTrue(file_prepare_directory($directory, FILE_CREATE_DIRECTORY), t('No error reported when creating a new directory.'), 'File');
+ $this->assertTrue(file_prepare_directory($directory, FILE_CREATE_DIRECTORY), 'No error reported when creating a new directory.', 'File');
// Make sure directory actually exists.
- $this->assertTrue(is_dir($directory), t('Directory actually exists.'), 'File');
+ $this->assertTrue(is_dir($directory), 'Directory actually exists.', 'File');
// Make directory read only.
@chmod($directory, 0444);
- $this->assertFalse(file_prepare_directory($directory, 0), t('Error reported for a non-writeable directory.'), 'File');
+ $this->assertFalse(file_prepare_directory($directory, 0), 'Error reported for a non-writeable directory.', 'File');
// Test directory permission modification.
- $this->assertTrue(file_prepare_directory($directory, FILE_MODIFY_PERMISSIONS), t('No error reported when making directory writeable.'), 'File');
+ $this->assertTrue(file_prepare_directory($directory, FILE_MODIFY_PERMISSIONS), 'No error reported when making directory writeable.', 'File');
// Test directory permission modification actually set correct permissions.
$this->assertDirectoryPermissions($directory, variable_get('file_chmod_directory', 0775));
@@ -879,12 +879,12 @@ class FileDirectoryTest extends FileTestCase {
// Remove .htaccess file to then test that it gets re-created.
$directory = file_directory_path();
@unlink($directory . '/.htaccess');
- $this->assertFalse(is_file($directory . '/.htaccess'), t('Successfully removed the .htaccess file in the files directory.'), 'File');
+ $this->assertFalse(is_file($directory . '/.htaccess'), 'Successfully removed the .htaccess file in the files directory.', 'File');
file_ensure_htaccess();
- $this->assertTrue(is_file($directory . '/.htaccess'), t('Successfully re-created the .htaccess file in the files directory.'), 'File');
+ $this->assertTrue(is_file($directory . '/.htaccess'), 'Successfully re-created the .htaccess file in the files directory.', 'File');
// Verify contents of .htaccess file.
$file = file_get_contents(file_directory_path() . '/.htaccess');
- $this->assertEqual($file, "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\nOptions +FollowSymLinks", t('The .htaccess file contains the proper content.'), 'File');
+ $this->assertEqual($file, "SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nOptions None\nOptions +FollowSymLinks", 'The .htaccess file contains the proper content.', 'File');
}
/**
@@ -893,7 +893,7 @@ class FileDirectoryTest extends FileTestCase {
function testFileDirectoryPath() {
// Directory path.
$path = variable_get('file_public_path', '');
- $this->assertEqual($path, file_directory_path('public'), t('Properly returns the stored file directory path.'), 'File');
+ $this->assertEqual($path, file_directory_path('public'), 'Properly returns the stored file directory path.', 'File');
}
/**
@@ -903,7 +903,7 @@ class FileDirectoryTest extends FileTestCase {
// Temporary directory handling.
variable_set('file_directory_temp', NULL);
$temp = file_directory_temp();
- $this->assertTrue(!is_null($temp), t('Properly set and retrieved temp directory %directory.', array('%directory' => $temp)), 'File');
+ $this->assertTrue(!is_null($temp), 'Properly set and retrieved temp directory ' . $temp . '.', 'File');
}
/**
@@ -917,14 +917,14 @@ class FileDirectoryTest extends FileTestCase {
$directory = 'misc';
$original = $directory . '/' . $basename;
$path = file_create_filename($basename, $directory);
- $this->assertEqual($path, $original, t('New filepath %new equals %original.', array('%new' => $path, '%original' => $original)), 'File');
+ $this->assertEqual($path, $original, 'New filepath ' . $path . ' equals ' . $original . '.', 'File');
// Then we test against a file that already exists within that directory.
$basename = 'druplicon.png';
$original = $directory . '/' . $basename;
$expected = $directory . '/druplicon_0.png';
$path = file_create_filename($basename, $directory);
- $this->assertEqual($path, $expected, t('Creating a new filepath from %original equals %new.', array('%new' => $path, '%original' => $original)), 'File');
+ $this->assertEqual($path, $expected, 'Creating a new filepath from ' . $original . ' equals ' . $path . '.', 'File');
// @TODO: Finally we copy a file into a directory several times, to ensure a properly iterating filename suffix.
}
@@ -945,19 +945,19 @@ class FileDirectoryTest extends FileTestCase {
// First test for non-existent file.
$destination = 'misc/xyz.txt';
$path = file_destination($destination, FILE_EXISTS_REPLACE);
- $this->assertEqual($path, $destination, t('Non-existing filepath destination is correct with FILE_EXISTS_REPLACE.'), 'File');
+ $this->assertEqual($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_REPLACE.', 'File');
$path = file_destination($destination, FILE_EXISTS_RENAME);
- $this->assertEqual($path, $destination, t('Non-existing filepath destination is correct with FILE_EXISTS_RENAME.'), 'File');
+ $this->assertEqual($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_RENAME.', 'File');
$path = file_destination($destination, FILE_EXISTS_ERROR);
- $this->assertEqual($path, $destination, t('Non-existing filepath destination is correct with FILE_EXISTS_ERROR.'), 'File');
+ $this->assertEqual($path, $destination, 'Non-existing filepath destination is correct with FILE_EXISTS_ERROR.', 'File');
$destination = 'misc/druplicon.png';
$path = file_destination($destination, FILE_EXISTS_REPLACE);
- $this->assertEqual($path, $destination, t('Existing filepath destination remains the same with FILE_EXISTS_REPLACE.'), 'File');
+ $this->assertEqual($path, $destination, 'Existing filepath destination remains the same with FILE_EXISTS_REPLACE.', 'File');
$path = file_destination($destination, FILE_EXISTS_RENAME);
- $this->assertNotEqual($path, $destination, t('A new filepath destination is created when filepath destination already exists with FILE_EXISTS_RENAME.'), 'File');
+ $this->assertNotEqual($path, $destination, 'A new filepath destination is created when filepath destination already exists with FILE_EXISTS_RENAME.', 'File');
$path = file_destination($destination, FILE_EXISTS_ERROR);
- $this->assertEqual($path, FALSE, t('An error is returned when filepath destination already exists with FILE_EXISTS_ERROR.'), 'File');
+ $this->assertEqual($path, FALSE, 'An error is returned when filepath destination already exists with FILE_EXISTS_ERROR.', 'File');
}
}
@@ -987,21 +987,21 @@ class FileScanDirectoryTest extends FileTestCase {
// 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.');
}
/**
@@ -1010,18 +1010,18 @@ class FileScanDirectoryTest extends FileTestCase {
function testOptionCallback() {
// 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.');
}
/**
@@ -1030,11 +1030,11 @@ class FileScanDirectoryTest extends FileTestCase {
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.');
}
/**
@@ -1045,25 +1045,25 @@ class FileScanDirectoryTest extends FileTestCase {
$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.');
}
/**
@@ -1071,10 +1071,10 @@ class FileScanDirectoryTest extends FileTestCase {
*/
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.');
}
@@ -1084,10 +1084,10 @@ class FileScanDirectoryTest extends FileTestCase {
*/
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.");
}
}
@@ -1112,8 +1112,8 @@ class FileUnmanagedDeleteTest extends FileTestCase {
$file = $this->createFile();
// Delete a regular file
- $this->assertTrue(file_unmanaged_delete($file->uri), t('Deleted worked.'));
- $this->assertFalse(file_exists($file->uri), t('Test file has actually been deleted.'));
+ $this->assertTrue(file_unmanaged_delete($file->uri), 'Deleted worked.');
+ $this->assertFalse(file_exists($file->uri), 'Test file has actually been deleted.');
}
/**
@@ -1121,7 +1121,7 @@ class FileUnmanagedDeleteTest extends FileTestCase {
*/
function testMissing() {
// Try to delete a non-existing file
- $this->assertTrue(file_unmanaged_delete(file_directory_path() . '/' . $this->randomName()), t('Returns true when deleting a non-existent file.'));
+ $this->assertTrue(file_unmanaged_delete(file_directory_path() . '/' . $this->randomName()), 'Returns true when deleting a non-existent file.');
}
/**
@@ -1132,8 +1132,8 @@ class FileUnmanagedDeleteTest extends FileTestCase {
$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.');
}
}
@@ -1159,8 +1159,8 @@ class FileUnmanagedDeleteRecursiveTest extends FileTestCase {
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.');
}
/**
@@ -1171,8 +1171,8 @@ class FileUnmanagedDeleteRecursiveTest extends FileTestCase {
$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.');
}
/**
@@ -1187,10 +1187,10 @@ class FileUnmanagedDeleteRecursiveTest extends FileTestCase {
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.');
}
/**
@@ -1206,11 +1206,11 @@ class FileUnmanagedDeleteRecursiveTest extends FileTestCase {
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.');
}
}
@@ -1237,21 +1237,21 @@ class FileUnmanagedMoveTest extends FileTestCase {
// Moving to a new name.
$desired_filepath = 'public://' . $this->randomName();
$new_filepath = file_unmanaged_move($file->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($file->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($file->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)
@@ -1264,7 +1264,7 @@ class FileUnmanagedMoveTest extends FileTestCase {
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.');
}
/**
@@ -1276,14 +1276,14 @@ class FileUnmanagedMoveTest extends FileTestCase {
// Move the file onto itself without renaming shouldn't make changes.
$new_filepath = file_unmanaged_move($file->uri, $file->uri, FILE_EXISTS_REPLACE);
- $this->assertFalse($new_filepath, t('Moving onto itself without renaming fails.'));
- $this->assertTrue(file_exists($file->uri), t('File exists after moving onto itself.'));
+ $this->assertFalse($new_filepath, 'Moving onto itself without renaming fails.');
+ $this->assertTrue(file_exists($file->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($file->uri, $file->uri, FILE_EXISTS_RENAME);
- $this->assertTrue($new_filepath, t('Moving onto itself with renaming works.'));
- $this->assertFalse(file_exists($file->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($file->uri), 'Original file has been removed.');
+ $this->assertTrue(file_exists($new_filepath), 'File exists after moving onto itself.');
}
}
@@ -1310,20 +1310,20 @@ class FileUnmanagedCopyTest extends FileTestCase {
// Copying to a new name.
$desired_filepath = 'public://' . $this->randomName();
$new_filepath = file_unmanaged_copy($file->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($file->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($file->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($file->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($file->uri), t('Original file remains.'));
- $this->assertTrue(file_exists($newer_filepath), t('New file exists.'));
+ $this->assertTrue($newer_filepath, 'Copy was successful.');
+ $this->assertNotEqual($newer_filepath, $desired_filepath, 'Returned expected filepath.');
+ $this->assertTrue(file_exists($file->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)
@@ -1336,9 +1336,9 @@ class FileUnmanagedCopyTest extends FileTestCase {
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.');
}
/**
@@ -1350,28 +1350,28 @@ class FileUnmanagedCopyTest extends FileTestCase {
// Copy the file onto itself with renaming works.
$new_filepath = file_unmanaged_copy($file->uri, $file->uri, FILE_EXISTS_RENAME);
- $this->assertTrue($new_filepath, t('Copying onto itself with renaming works.'));
- $this->assertNotEqual($new_filepath, $file->uri, t('Copied file has a new name.'));
- $this->assertTrue(file_exists($file->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, $file->uri, 'Copied file has a new name.');
+ $this->assertTrue(file_exists($file->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($file->uri, $file->uri, FILE_EXISTS_ERROR);
- $this->assertFalse($new_filepath, t('Copying onto itself without renaming fails.'));
- $this->assertTrue(file_exists($file->uri), t('File exists after copying onto itself.'));
+ $this->assertFalse($new_filepath, 'Copying onto itself without renaming fails.');
+ $this->assertTrue(file_exists($file->uri), 'File exists after copying onto itself.');
// Copy the file into same directory without renaming fails.
$new_filepath = file_unmanaged_copy($file->uri, drupal_dirname($file->uri), FILE_EXISTS_ERROR);
- $this->assertFalse($new_filepath, t('Copying onto itself fails.'));
- $this->assertTrue(file_exists($file->uri), t('File exists after copying onto itself.'));
+ $this->assertFalse($new_filepath, 'Copying onto itself fails.');
+ $this->assertTrue(file_exists($file->uri), 'File exists after copying onto itself.');
// Copy the file into same directory with renaming works.
$new_filepath = file_unmanaged_copy($file->uri, drupal_dirname($file->uri), FILE_EXISTS_RENAME);
- $this->assertTrue($new_filepath, t('Copying into same directory works.'));
- $this->assertNotEqual($new_filepath, $file->uri, t('Copied file has a new name.'));
- $this->assertTrue(file_exists($file->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, $file->uri, 'Copied file has a new name.');
+ $this->assertTrue(file_exists($file->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));
}
}
@@ -1395,11 +1395,11 @@ class FileDeleteTest extends FileHookTestCase {
$file = $this->createFile();
// Check that deletion removes the file and database record.
- $this->assertTrue(is_file($file->uri), t("File exists."));
- $this->assertIdentical(file_delete($file), TRUE, t("Delete worked."));
+ $this->assertTrue(is_file($file->uri), "File exists.");
+ $this->assertIdentical(file_delete($file), TRUE, "Delete worked.");
$this->assertFileHooksCalled(array('references', 'delete'));
- $this->assertFalse(file_exists($file->uri), t("Test file has actually been deleted."));
- $this->assertFalse(file_load($file->fid), t('File was removed from the database.'));
+ $this->assertFalse(file_exists($file->uri), "Test file has actually been deleted.");
+ $this->assertFalse(file_load($file->fid), 'File was removed from the database.');
// TODO: implement hook_file_references() in file_test.module and report a
// file in use and test the $force parameter.
@@ -1432,20 +1432,20 @@ class FileMoveTest extends FileHookTestCase {
$result = file_move(clone $source, $desired_filepath, FILE_EXISTS_ERROR);
// Check the return status and that the contents changed.
- $this->assertTrue($result, t('File moved sucessfully.'));
+ $this->assertTrue($result, 'File moved sucessfully.');
$this->assertFalse(file_exists($source->uri));
- $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file correctly written.'));
+ $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file correctly written.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('move', 'update'));
// Make sure we got the same file back.
- $this->assertEqual($source->fid, $result->fid, t("Source file id's' %fid is unchanged after move.", array('%fid' => $source->fid)));
+ $this->assertEqual($source->fid, $result->fid, "Source file id's' " . $source->fid . " is unchanged after move.");
// Reload the file from the database and check that the changes were
// actually saved.
$loaded_file = file_load($result->fid, TRUE);
- $this->assertTrue($loaded_file, t('File can be loaded from the database.'));
+ $this->assertTrue($loaded_file, 'File can be loaded from the database.');
$this->assertFileUnchanged($result, $loaded_file);
}
@@ -1464,9 +1464,9 @@ class FileMoveTest extends FileHookTestCase {
$result = file_move(clone $source, $target->uri, FILE_EXISTS_RENAME);
// Check the return status and that the contents changed.
- $this->assertTrue($result, t('File moved sucessfully.'));
+ $this->assertTrue($result, 'File moved sucessfully.');
$this->assertFalse(file_exists($source->uri));
- $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file correctly written.'));
+ $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file correctly written.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('move', 'update'));
@@ -1480,8 +1480,8 @@ class FileMoveTest extends FileHookTestCase {
// Compare the source and results.
$loaded_source = file_load($source->fid, TRUE);
- $this->assertEqual($loaded_source->fid, $result->fid, t("Returned file's id matches the source."));
- $this->assertNotEqual($loaded_source->uri, $source->uri, t("Returned file path has changed from the original."));
+ $this->assertEqual($loaded_source->fid, $result->fid, "Returned file's id matches the source.");
+ $this->assertNotEqual($loaded_source->uri, $source->uri, "Returned file path has changed from the original.");
}
/**
@@ -1499,9 +1499,9 @@ class FileMoveTest extends FileHookTestCase {
$result = file_move(clone $source, $target->uri, FILE_EXISTS_REPLACE);
// Look at the results.
- $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were overwritten.'));
+ $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file were overwritten.');
$this->assertFalse(file_exists($source->uri));
- $this->assertTrue($result, t('File moved sucessfully.'));
+ $this->assertTrue($result, 'File moved sucessfully.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('move', 'update', 'delete', 'references', 'load'));
@@ -1527,8 +1527,8 @@ class FileMoveTest extends FileHookTestCase {
// Copy the file over itself. Clone the object so we don't have to worry
// about the function changing our reference copy.
$result = file_move(clone $source, $source->uri, FILE_EXISTS_REPLACE);
- $this->assertFalse($result, t('File move failed.'));
- $this->assertEqual($contents, file_get_contents($source->uri), t('Contents of file were not altered.'));
+ $this->assertFalse($result, 'File move failed.');
+ $this->assertEqual($contents, file_get_contents($source->uri), 'Contents of file were not altered.');
// Check that no hooks were called while failing.
$this->assertFileHooksCalled(array());
@@ -1553,9 +1553,9 @@ class FileMoveTest extends FileHookTestCase {
$result = file_move(clone $source, $target->uri, FILE_EXISTS_ERROR);
// Check the return status and that the contents did not change.
- $this->assertFalse($result, t('File move failed.'));
+ $this->assertFalse($result, 'File move failed.');
$this->assertTrue(file_exists($source->uri));
- $this->assertEqual($contents, file_get_contents($target->uri), t('Contents of file were not altered.'));
+ $this->assertEqual($contents, file_get_contents($target->uri), 'Contents of file were not altered.');
// Check that no hooks were called while failing.
$this->assertFileHooksCalled(array());
@@ -1593,16 +1593,16 @@ class FileCopyTest extends FileHookTestCase {
$result = file_copy(clone $source, $desired_uri, FILE_EXISTS_ERROR);
// Check the return status and that the contents changed.
- $this->assertTrue($result, t('File copied sucessfully.'));
- $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were copied correctly.'));
+ $this->assertTrue($result, 'File copied sucessfully.');
+ $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file were copied correctly.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('copy', 'insert'));
$this->assertDifferentFile($source, $result);
- $this->assertEqual($result->uri, $desired_uri, t('The copied file object has the desired filepath.'));
- $this->assertTrue(file_exists($source->uri), t('The original file still exists.'));
- $this->assertTrue(file_exists($result->uri), t('The copied file exists.'));
+ $this->assertEqual($result->uri, $desired_uri, 'The copied file object has the desired filepath.');
+ $this->assertTrue(file_exists($source->uri), 'The original file still exists.');
+ $this->assertTrue(file_exists($result->uri), 'The copied file exists.');
// Reload the file from the database and check that the changes were
// actually saved.
@@ -1624,9 +1624,9 @@ class FileCopyTest extends FileHookTestCase {
$result = file_copy(clone $source, $target->uri, FILE_EXISTS_RENAME);
// Check the return status and that the contents changed.
- $this->assertTrue($result, t('File copied sucessfully.'));
- $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were copied correctly.'));
- $this->assertNotEqual($result->uri, $source->uri, t('Returned file path has changed from the original.'));
+ $this->assertTrue($result, 'File copied sucessfully.');
+ $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file were copied correctly.');
+ $this->assertNotEqual($result->uri, $source->uri, 'Returned file path has changed from the original.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('copy', 'insert'));
@@ -1664,8 +1664,8 @@ class FileCopyTest extends FileHookTestCase {
$result = file_copy(clone $source, $target->uri, FILE_EXISTS_REPLACE);
// Check the return status and that the contents changed.
- $this->assertTrue($result, t('File copied sucessfully.'));
- $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of file were overwritten.'));
+ $this->assertTrue($result, 'File copied sucessfully.');
+ $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of file were overwritten.');
$this->assertDifferentFile($source, $result);
// Check that the correct hooks were called.
@@ -1702,8 +1702,8 @@ class FileCopyTest extends FileHookTestCase {
$result = file_copy(clone $source, $target->uri, FILE_EXISTS_ERROR);
// Check the return status and that the contents were not changed.
- $this->assertFalse($result, t('File copy failed.'));
- $this->assertEqual($contents, file_get_contents($target->uri), t('Contents of file were not altered.'));
+ $this->assertFalse($result, 'File copy failed.');
+ $this->assertEqual($contents, file_get_contents($target->uri), 'Contents of file were not altered.');
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array());
@@ -1730,7 +1730,7 @@ class FileLoadTest extends FileHookTestCase {
* Try to load a non-existent file by fid.
*/
function testLoadMissingFid() {
- $this->assertFalse(file_load(-1), t("Try to load an invalid fid fails."));
+ $this->assertFalse(file_load(-1), "Try to load an invalid fid fails.");
$this->assertFileHooksCalled(array());
}
@@ -1739,7 +1739,7 @@ class FileLoadTest extends FileHookTestCase {
*/
function testLoadMissingFilepath() {
$files = file_load_multiple(array(), array('uri' => 'foobar://misc/druplicon.png'));
- $this->assertFalse(reset($files), t("Try to load a file that doesn't exist in the database fails."));
+ $this->assertFalse(reset($files), "Try to load a file that doesn't exist in the database fails.");
$this->assertFileHooksCalled(array());
}
@@ -1748,7 +1748,7 @@ class FileLoadTest extends FileHookTestCase {
*/
function testLoadInvalidStatus() {
$files = file_load_multiple(array(), array('status' => -99));
- $this->assertFalse(reset($files), t("Trying to load a file with an invalid status fails."));
+ $this->assertFalse(reset($files), "Trying to load a file with an invalid status fails.");
$this->assertFileHooksCalled(array());
}
@@ -1761,13 +1761,13 @@ class FileLoadTest extends FileHookTestCase {
$by_fid_file = file_load($file->fid);
$this->assertFileHookCalled('load');
- $this->assertTrue(is_object($by_fid_file), t('file_load() returned an object.'));
- $this->assertEqual($by_fid_file->fid, $file->fid, t("Loading by fid got the same fid."), 'File');
- $this->assertEqual($by_fid_file->uri, $file->uri, t("Loading by fid got the correct filepath."), 'File');
- $this->assertEqual($by_fid_file->filename, $file->filename, t("Loading by fid got the correct filename."), 'File');
- $this->assertEqual($by_fid_file->filemime, $file->filemime, t("Loading by fid got the correct MIME type."), 'File');
- $this->assertEqual($by_fid_file->status, $file->status, t("Loading by fid got the correct status."), 'File');
- $this->assertTrue($by_fid_file->file_test['loaded'], t('file_test_file_load() was able to modify the file during load.'));
+ $this->assertTrue(is_object($by_fid_file), 'file_load() returned an object.');
+ $this->assertEqual($by_fid_file->fid, $file->fid, "Loading by fid got the same fid.", 'File');
+ $this->assertEqual($by_fid_file->uri, $file->uri, "Loading by fid got the correct filepath.", 'File');
+ $this->assertEqual($by_fid_file->filename, $file->filename, "Loading by fid got the correct filename.", 'File');
+ $this->assertEqual($by_fid_file->filemime, $file->filemime, "Loading by fid got the correct MIME type.", 'File');
+ $this->assertEqual($by_fid_file->status, $file->status, "Loading by fid got the correct status.", 'File');
+ $this->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
}
/**
@@ -1781,19 +1781,19 @@ class FileLoadTest extends FileHookTestCase {
file_test_reset();
$by_path_files = file_load_multiple(array(), array('uri' => $file->uri));
$this->assertFileHookCalled('load');
- $this->assertEqual(1, count($by_path_files), t('file_load_multiple() returned an array of the correct size.'));
+ $this->assertEqual(1, count($by_path_files), 'file_load_multiple() returned an array of the correct size.');
$by_path_file = reset($by_path_files);
- $this->assertTrue($by_path_file->file_test['loaded'], t('file_test_file_load() was able to modify the file during load.'));
- $this->assertEqual($by_path_file->fid, $file->fid, t("Loading by filepath got the correct fid."), 'File');
+ $this->assertTrue($by_path_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
+ $this->assertEqual($by_path_file->fid, $file->fid, "Loading by filepath got the correct fid.", 'File');
// Load by fid.
file_test_reset();
$by_fid_files = file_load_multiple(array($file->fid), array());
$this->assertFileHookCalled('load');
- $this->assertEqual(1, count($by_fid_files), t('file_load_multiple() returned an array of the correct size.'));
+ $this->assertEqual(1, count($by_fid_files), 'file_load_multiple() returned an array of the correct size.');
$by_fid_file = reset($by_fid_files);
- $this->assertTrue($by_fid_file->file_test['loaded'], t('file_test_file_load() was able to modify the file during load.'));
- $this->assertEqual($by_fid_file->uri, $file->uri, t("Loading by fid got the correct filepath."), 'File');
+ $this->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
+ $this->assertEqual($by_fid_file->uri, $file->uri, "Loading by fid got the correct filepath.", 'File');
}
}
@@ -1828,13 +1828,13 @@ class FileSaveTest extends FileHookTestCase {
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('insert'));
- $this->assertNotNull($saved_file, t("Saving the file should give us back a file object."), 'File');
- $this->assertTrue($saved_file->fid > 0, t("A new file ID is set when saving a new file to the database."), 'File');
+ $this->assertNotNull($saved_file, "Saving the file should give us back a file object.", 'File');
+ $this->assertTrue($saved_file->fid > 0, "A new file ID is set when saving a new file to the database.", 'File');
$loaded_file = db_query('SELECT * FROM {file_managed} f WHERE f.fid = :fid', array(':fid' => $saved_file->fid))->fetch(PDO::FETCH_OBJ);
- $this->assertNotNull($loaded_file, t("Record exists in the database."));
- $this->assertEqual($loaded_file->status, $file->status, t("Status was saved correctly."));
- $this->assertEqual($saved_file->filesize, filesize($file->uri), t("File size was set correctly."), 'File');
- $this->assertTrue($saved_file->timestamp > 1, t("File size was set correctly."), 'File');
+ $this->assertNotNull($loaded_file, "Record exists in the database.");
+ $this->assertEqual($loaded_file->status, $file->status, "Status was saved correctly.");
+ $this->assertEqual($saved_file->filesize, filesize($file->uri), "File size was set correctly.", 'File');
+ $this->assertTrue($saved_file->timestamp > 1, "File size was set correctly.", 'File');
// Resave the file, updating the existing record.
@@ -1845,11 +1845,11 @@ class FileSaveTest extends FileHookTestCase {
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('update'));
- $this->assertEqual($resaved_file->fid, $saved_file->fid, t("The file ID of an existing file is not changed when updating the database."), 'File');
- $this->assertTrue($resaved_file->timestamp >= $saved_file->timestamp, t("Timestamp didn't go backwards."), 'File');
+ $this->assertEqual($resaved_file->fid, $saved_file->fid, "The file ID of an existing file is not changed when updating the database.", 'File');
+ $this->assertTrue($resaved_file->timestamp >= $saved_file->timestamp, "Timestamp didn't go backwards.", 'File');
$loaded_file = db_query('SELECT * FROM {file_managed} f WHERE f.fid = :fid', array(':fid' => $saved_file->fid))->fetch(PDO::FETCH_OBJ);
- $this->assertNotNull($loaded_file, t("Record still exists in the database."), 'File');
- $this->assertEqual($loaded_file->status, $saved_file->status, t("Status was saved correctly."));
+ $this->assertNotNull($loaded_file, "Record still exists in the database.", 'File');
+ $this->assertEqual($loaded_file->status, $saved_file->status, "Status was saved correctly.");
}
}
@@ -1873,7 +1873,7 @@ class FileValidateTest extends FileHookTestCase {
$file = $this->createFile();
// Empty validators.
- $this->assertEqual(file_validate($file, array()), array(), t('Validating an empty array works succesfully.'));
+ $this->assertEqual(file_validate($file, array()), array(), 'Validating an empty array works succesfully.');
$this->assertFileHooksCalled(array('validate'));
// Use the file_test.module's test validator to ensure that passing tests
@@ -1881,14 +1881,14 @@ class FileValidateTest extends FileHookTestCase {
file_test_reset();
file_test_set_return('validate', array());
$passing = array('file_test_validator' => array(array()));
- $this->assertEqual(file_validate($file, $passing), array(), t('Validating passes.'));
+ $this->assertEqual(file_validate($file, $passing), array(), 'Validating passes.');
$this->assertFileHooksCalled(array('validate'));
// Now test for failures in validators passed in and by hook_validate.
file_test_reset();
file_test_set_return('validate', array('Epic fail'));
$failing = array('file_test_validator' => array(array('Failed', 'Badly')));
- $this->assertEqual(file_validate($file, $failing), array('Failed', 'Badly', 'Epic fail'), t('Validating returns errors.'));
+ $this->assertEqual(file_validate($file, $failing), array('Failed', 'Badly', 'Epic fail'), 'Validating returns errors.');
$this->assertFileHooksCalled(array('validate'));
}
}
@@ -1912,13 +1912,13 @@ class FileSaveDataTest extends FileHookTestCase {
$contents = $this->randomName(8);
$result = file_save_data($contents);
- $this->assertTrue($result, t('Unnamed file saved correctly.'));
+ $this->assertTrue($result, 'Unnamed file saved correctly.');
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), t("File was placed in Drupal's files directory."));
- $this->assertEqual($result->filename, basename($result->uri), t("Filename was set to the file's basename."));
- $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.'));
- $this->assertEqual($result->filemime, 'application/octet-stream', t('A MIME type was set.'));
- $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), "File was placed in Drupal's files directory.");
+ $this->assertEqual($result->filename, basename($result->uri), "Filename was set to the file's basename.");
+ $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of the file are correct.');
+ $this->assertEqual($result->filemime, 'application/octet-stream', 'A MIME type was set.');
+ $this->assertEqual($result->status, FILE_STATUS_PERMANENT, "The file's status was set to permanent.");
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('insert'));
@@ -1934,13 +1934,13 @@ class FileSaveDataTest extends FileHookTestCase {
$contents = $this->randomName(8);
$result = file_save_data($contents, 'public://' . 'asdf.txt');
- $this->assertTrue($result, t('Unnamed file saved correctly.'));
+ $this->assertTrue($result, 'Unnamed file saved correctly.');
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), t("File was placed in Drupal's files directory."));
- $this->assertEqual('asdf.txt', basename($result->uri), t('File was named correctly.'));
- $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.'));
- $this->assertEqual($result->filemime, 'text/plain', t('A MIME type was set.'));
- $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), "File was placed in Drupal's files directory.");
+ $this->assertEqual('asdf.txt', basename($result->uri), 'File was named correctly.');
+ $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of the file are correct.');
+ $this->assertEqual($result->filemime, 'text/plain', 'A MIME type was set.');
+ $this->assertEqual($result->status, FILE_STATUS_PERMANENT, "The file's status was set to permanent.");
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('insert'));
@@ -1958,13 +1958,13 @@ class FileSaveDataTest extends FileHookTestCase {
$contents = $this->randomName(8);
$result = file_save_data($contents, $existing->uri, FILE_EXISTS_RENAME);
- $this->assertTrue($result, t("File saved sucessfully."));
+ $this->assertTrue($result, "File saved sucessfully.");
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), t("File was placed in Drupal's files directory."));
- $this->assertEqual($result->filename, $existing->filename, t("Filename was set to the basename of the source, rather than that of the renamed file."));
- $this->assertEqual($contents, file_get_contents($result->uri), t("Contents of the file are correct."));
- $this->assertEqual($result->filemime, 'application/octet-stream', t("A MIME type was set."));
- $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), "File was placed in Drupal's files directory.");
+ $this->assertEqual($result->filename, $existing->filename, "Filename was set to the basename of the source, rather than that of the renamed file.");
+ $this->assertEqual($contents, file_get_contents($result->uri), "Contents of the file are correct.");
+ $this->assertEqual($result->filemime, 'application/octet-stream', "A MIME type was set.");
+ $this->assertEqual($result->status, FILE_STATUS_PERMANENT, "The file's status was set to permanent.");
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('insert'));
@@ -1986,13 +1986,13 @@ class FileSaveDataTest extends FileHookTestCase {
$contents = $this->randomName(8);
$result = file_save_data($contents, $existing->uri, FILE_EXISTS_REPLACE);
- $this->assertTrue($result, t('File saved sucessfully.'));
+ $this->assertTrue($result, 'File saved sucessfully.');
- $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), t("File was placed in Drupal's files directory."));
- $this->assertEqual($result->filename, $existing->filename, t('Filename was set to the basename of the existing file, rather than preserving the original name.'));
- $this->assertEqual($contents, file_get_contents($result->uri), t('Contents of the file are correct.'));
- $this->assertEqual($result->filemime, 'application/octet-stream', t('A MIME type was set.'));
- $this->assertEqual($result->status, FILE_STATUS_PERMANENT, t("The file's status was set to permanent."));
+ $this->assertEqual(file_directory_path('public'), file_directory_path(file_stream_wrapper_valid_scheme($result->uri)), "File was placed in Drupal's files directory.");
+ $this->assertEqual($result->filename, $existing->filename, 'Filename was set to the basename of the existing file, rather than preserving the original name.');
+ $this->assertEqual($contents, file_get_contents($result->uri), 'Contents of the file are correct.');
+ $this->assertEqual($result->filemime, 'application/octet-stream', 'A MIME type was set.');
+ $this->assertEqual($result->status, FILE_STATUS_PERMANENT, "The file's status was set to permanent.");
// Check that the correct hooks were called.
$this->assertFileHooksCalled(array('load', 'update'));
@@ -2013,8 +2013,8 @@ class FileSaveDataTest extends FileHookTestCase {
// Check the overwrite error.
$result = file_save_data('asdf', $existing->uri, FILE_EXISTS_ERROR);
- $this->assertFalse($result, t('Overwriting a file fails when FILE_EXISTS_ERROR is specified.'));
- $this->assertEqual($contents, file_get_contents($existing->uri), t('Contents of existing file were unchanged.'));
+ $this->assertFalse($result, 'Overwriting a file fails when FILE_EXISTS_ERROR is specified.');
+ $this->assertEqual($contents, file_get_contents($existing->uri), 'Contents of existing file were unchanged.');
// Check that no hooks were called while failing.
$this->assertFileHooksCalled(array());
@@ -2049,17 +2049,17 @@ class FileDownloadTest extends FileTestCase {
// Test generating an URL to a created file.
$file = $this->createFile();
$url = file_create_url($file->uri);
- $this->assertEqual($GLOBALS['base_url'] . '/' . file_directory_path() . '/' . $file->filename, $url, t('Correctly generated a URL for a created file.'));
+ $this->assertEqual($GLOBALS['base_url'] . '/' . file_directory_path() . '/' . $file->filename, $url, 'Correctly generated a URL for a created file.');
$this->drupalHead($url);
- $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the created file.'));
+ $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the created file.');
// Test generating an URL to a shipped file (i.e. a file that is part of
// Drupal core, a module or a theme, for example a JavaScript file).
$filepath = 'misc/jquery.js';
$url = file_create_url($filepath);
- $this->assertEqual($GLOBALS['base_url'] . '/' . $filepath, $url, t('Correctly generated a URL for a shipped file.'));
+ $this->assertEqual($GLOBALS['base_url'] . '/' . $filepath, $url, 'Correctly generated a URL for a shipped file.');
$this->drupalHead($url);
- $this->assertResponse(200, t('Confirmed that the generated URL is correct by downloading the shipped file.'));
+ $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
}
/**
@@ -2076,18 +2076,18 @@ class FileDownloadTest extends FileTestCase {
file_test_set_return('download', array('x-foo' => 'Bar'));
$this->drupalHead($url);
$headers = $this->drupalGetHeaders();
- $this->assertEqual($headers['x-foo'] , 'Bar', t('Found header set by file_test module on private download.'));
- $this->assertResponse(200, t('Correctly allowed access to a file when file_test provides headers.'));
+ $this->assertEqual($headers['x-foo'], 'Bar', 'Found header set by file_test module on private download.');
+ $this->assertResponse(200, 'Correctly allowed access to a file when file_test provides headers.');
// Deny access to all downloads via a -1 header.
file_test_set_return('download', -1);
$this->drupalHead($url);
- $this->assertResponse(403, t('Correctly denied access to a file when file_test sets the header to -1.'));
+ $this->assertResponse(403, 'Correctly denied access to a file when file_test sets the header to -1.');
// Try non-existent file.
$url = file_create_url('private://' . $this->randomName());
$this->drupalHead($url);
- $this->assertResponse(404, t('Correctly returned 404 response for a non-existent file.'));
+ $this->assertResponse(404, 'Correctly returned 404 response for a non-existent file.');
}
/**
@@ -2141,7 +2141,7 @@ class FileDownloadTest extends FileTestCase {
$file = $this->createFile($filepath, NULL, $scheme);
$url = file_create_url($file->uri);
- $this->assertEqual($url, $expected_url, t('Generated URL matches expected URL.'));
+ $this->assertEqual($url, $expected_url, 'Generated URL matches expected URL.');
if ($scheme == 'private') {
// Tell the implementation of hook_file_download() in file_test.module
@@ -2151,7 +2151,7 @@ class FileDownloadTest extends FileTestCase {
$this->drupalGet($url);
if ($this->assertResponse(200) == 'pass') {
- $this->assertRaw(file_get_contents($file->uri), t('Contents of the file are correct.'));
+ $this->assertRaw(file_get_contents($file->uri), 'Contents of the file are correct.');
}
file_delete($file);
@@ -2177,7 +2177,7 @@ class FileURLRewritingTest extends FileTestCase {
/**
* Test the generating of rewritten shipped file URLs.
*/
- function testShippedFileURL() {
+ function testShippedFileURL() {
// Test generating an URL to a shipped file (i.e. a file that is part of
// Drupal core, a module or a theme, for example a JavaScript file).
@@ -2185,28 +2185,28 @@ class FileURLRewritingTest extends FileTestCase {
variable_set('file_test_hook_file_url_alter', 'cdn');
$filepath = '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 = '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 = '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 = '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 = '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 = '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.');
}
/**
@@ -2219,19 +2219,19 @@ class FileURLRewritingTest extends FileTestCase {
variable_set('file_test_hook_file_url_alter', 'cdn');
$file = $this->createFile();
$url = file_create_url($file->uri);
- $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . file_directory_path() . '/' . $file->filename, $url, t('Correctly generated a CDN URL for a created file.'));
+ $this->assertEqual(FILE_URL_TEST_CDN_2 . '/' . file_directory_path() . '/' . $file->filename, $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');
$file = $this->createFile();
$url = file_create_url($file->uri);
- $this->assertEqual(base_path() . '/' . file_directory_path() . '/' . $file->filename, $url, t('Correctly generated a root-relative URL for a created file.'));
+ $this->assertEqual(base_path() . '/' . file_directory_path() . '/' . $file->filename, $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');
$file = $this->createFile();
$url = file_create_url($file->uri);
- $this->assertEqual('/' . base_path() . '/' . file_directory_path() . '/' . $file->filename, $url, t('Correctly generated a protocol-relative URL for a created file.'));
+ $this->assertEqual('/' . base_path() . '/' . file_directory_path() . '/' . $file->filename, $url, 'Correctly generated a protocol-relative URL for a created file.');
}
}
@@ -2261,8 +2261,8 @@ class FileNameMungingTest extends FileTestCase {
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, 'The new filename (' . $munged_name . ') has been modified from the original (' . $this->name . ')');
}
/**
@@ -2272,7 +2272,7 @@ class FileNameMungingTest extends FileTestCase {
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, 'The original filename (' . $this->name . ') matches the munged filename (' . $munged_name . ') when insecure uploads are enabled.');
}
/**
@@ -2281,7 +2281,7 @@ class FileNameMungingTest extends FileTestCase {
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, 'The new filename (' . $munged_name . ') matches the original (' . $this->name . ') once the extension has been whitelisted.');
}
/**
@@ -2338,11 +2338,11 @@ class FileMimeTypeTest extends DrupalWebTestCase {
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, 'Mimetype for ' . $input . ' is ' . $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, 'Mimetype (using default mappings) for ' . $input . ' is ' . $output . ' (expected: ' . $expected . ').');
}
// Now test passing in the map.
@@ -2374,7 +2374,7 @@ class FileMimeTypeTest extends DrupalWebTestCase {
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, 'Mimetype (using passed-in mappings) for ' . $input . ' is ' . $output . ' (expected: ' . $expected . ').');
}
}
}
@@ -2410,9 +2410,9 @@ class StreamWrapperTest extends DrupalWebTestCase {
*/
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('DrupalPublicStreamWrapper', file_stream_wrapper_get_class('public'), t('Got correct class name for public scheme.'));
+ $this->assertEqual('DrupalPublicStreamWrapper', file_stream_wrapper_get_class('public'), 'Got correct class name for public scheme.');
}
/**
@@ -2420,10 +2420,10 @@ class StreamWrapperTest extends DrupalWebTestCase {
*/
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('DrupalPublicStreamWrapper', get_class($instance), t('Got correct class type for public scheme.'));
+ $this->assertEqual('DrupalPublicStreamWrapper', get_class($instance), 'Got correct class type for public scheme.');
}
/**
@@ -2431,34 +2431,34 @@ class StreamWrapperTest extends DrupalWebTestCase {
*/
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('DrupalPublicStreamWrapper', get_class($instance), t('Got correct class type for public URI.'));
+ $this->assertEqual('DrupalPublicStreamWrapper', 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 file_directory_path().
- $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('public'), variable_get('file_public_path'), t('Expected public 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->assertFalse(file_directory_path('non-existent'), t('No directory path returned for invalid scheme.'));
+ $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', 'Expected scheme was added.');
+ $this->assertEqual(file_directory_path(), variable_get('file_public_path'), 'Expected default directory path was returned.');
+ $this->assertEqual(file_directory_path('public'), variable_get('file_public_path'), 'Expected public directory path was returned.');
+ $this->assertEqual(file_directory_path('temporary'), variable_get('file_temporary_path'), 'Expected temporary directory path was returned.');
+ $this->assertEqual(file_directory_path($this->scheme), variable_get('stream_public_path', 'sites/default/files'), 'Expected dummy directory path was returned.');
+ $this->assertFalse(file_directory_path('non-existent'), 'No directory path returned for invalid scheme.');
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_directory_path(), variable_get('file_private_path'), t('Expected default directory path was returned.'));
- $this->assertEqual(file_directory_path('private'), variable_get('file_private_path'), t('Expected private directory path was returned.'));
+ $this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', 'Got a valid URI from foo/bar.txt.');
+ $this->assertEqual(file_directory_path(), variable_get('file_private_path'), 'Expected default directory path was returned.');
+ $this->assertEqual(file_directory_path('private'), variable_get('file_private_path'), 'Expected private directory path was returned.');
}
/**
* 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/modules/simpletest/tests/filetransfer.test b/modules/simpletest/tests/filetransfer.test
index 03e966d03..e80696513 100644
--- a/modules/simpletest/tests/filetransfer.test
+++ b/modules/simpletest/tests/filetransfer.test
@@ -80,7 +80,7 @@ class FileTranferTest extends DrupalWebTestCase {
$gotit = TRUE;
try {
- $this->testConnection->copyDirectory($source, DRUPAL_ROOT . '/'. file_directory_path());
+ $this->testConnection->copyDirectory($source, DRUPAL_ROOT . '/' . file_directory_path());
}
catch (FileTransferException $e) {
$gotit = FALSE;
diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test
index 525a8a291..6ffd603ba 100644
--- a/modules/simpletest/tests/form.test
+++ b/modules/simpletest/tests/form.test
@@ -129,7 +129,7 @@ class FormsTestCase extends DrupalWebTestCase {
// First, try to submit without the required checkbox.
$edit = array();
$this->drupalPost('form-test/checkbox', $edit, t('Submit'));
- $this->assertRaw(t('!name field is required.', array('!name' => 'required_checkbox')), t('A required checkbox is actually mandatory'));
+ $this->assertRaw(t('!name field is required.', array('!name' => 'required_checkbox')), 'A required checkbox is actually mandatory');
// Now try to submit the form correctly.
$values = drupal_json_decode($this->drupalPost(NULL, array('required_checkbox' => 1), t('Submit')));
@@ -142,11 +142,7 @@ class FormsTestCase extends DrupalWebTestCase {
'zero_checkbox_off' => '',
);
foreach ($expected_values as $widget => $expected_value) {
- $this->assertEqual($values[$widget], $expected_value, t('Checkbox %widget returns expected value (expected: %expected, got: %value)', array(
- '%widget' => var_export($widget, TRUE),
- '%expected' => var_export($expected_value, TRUE),
- '%value' => var_export($values[$widget], TRUE),
- )));
+ $this->assertEqual($values[$widget], $expected_value, 'Checkbox ' . var_export($widget, TRUE) . ' returns expected value (expected: ' . var_export($expected_value, TRUE) . ', got: ' . var_export($values[$widget], TRUE) . ')');
}
}
@@ -193,7 +189,7 @@ class FormsTestCase extends DrupalWebTestCase {
// All the elements should be marked as disabled, including the ones below
// the disabled container.
- $this->assertEqual(count($disabled_elements), 32, t('The correct elements have the disabled property in the HTML code.'));
+ $this->assertEqual(count($disabled_elements), 32, 'The correct elements have the disabled property in the HTML code.');
$this->drupalPost(NULL, $edit, t('Submit'));
$returned_values['hijacked'] = drupal_json_decode($this->content);
@@ -222,7 +218,7 @@ class FormsTestCase extends DrupalWebTestCase {
// Checkboxes values are not filtered out.
$values[$key] = array_filter($values[$key]);
}
- $this->assertIdentical($expected_value, $values[$key], t('Default value for %type: expected %expected, returned %returned.', array('%type' => $key, '%expected' => var_export($expected_value, TRUE), '%returned' => var_export($values[$key], TRUE))));
+ $this->assertIdentical($expected_value, $values[$key], 'Default value for ' . $key . ': expected ' . var_export($expected_value, TRUE) . ', returned ' . var_export($values[$key], TRUE) . '.');
}
// Recurse children.
@@ -273,7 +269,7 @@ class FormsTestCase extends DrupalWebTestCase {
':div-class' => $class,
':value' => isset($item['#value']) ? $item['#value'] : '',
));
- $this->assertTrue(isset($element[0]), t('Disabled form element class found for #type %type.', array('%type' => $item['#type'])));
+ $this->assertTrue(isset($element[0]), 'Disabled form element class found for #type ' . $item['#type'] . '.');
}
// Verify special element #type text-format.
@@ -281,12 +277,12 @@ class FormsTestCase extends DrupalWebTestCase {
':name' => 'text_format[value]',
':div-class' => 'form-disabled',
));
- $this->assertTrue(isset($element[0]), t('Disabled form element class found for #type %type.', array('%type' => 'text_format[value]')));
+ $this->assertTrue(isset($element[0]), 'Disabled form element class found for #type ' . 'text_format[value]' . '.');
$element = $this->xpath('//div[contains(@class, :div-class)]/descendant::select[@name=:name]', array(
':name' => 'text_format[format]',
':div-class' => 'form-disabled',
));
- $this->assertTrue(isset($element[0]), t('Disabled form element class found for #type %type.', array('%type' => 'text_format[format]')));
+ $this->assertTrue(isset($element[0]), 'Disabled form element class found for #type ' . 'text_format[format]' . '.');
}
/**
@@ -299,7 +295,7 @@ class FormsTestCase extends DrupalWebTestCase {
$checkbox = $this->xpath('//input[@name="checkboxes[two]"]');
$checkbox[0]['value'] = 'FORGERY';
$this->drupalPost(NULL, array('checkboxes[one]' => TRUE, 'checkboxes[two]' => TRUE), t('Submit'));
- $this->assertText('An illegal choice has been detected.', t('Input forgery was detected.'));
+ $this->assertText('An illegal choice has been detected.', 'Input forgery was detected.');
}
}
@@ -333,7 +329,7 @@ class FormAlterTestCase extends DrupalWebTestCase {
'system_form_form_test_alter_form_alter() executed.',
);
$content = preg_replace('/\s+/', ' ', filter_xss($this->content, array()));
- $this->assert(strpos($content, implode(' ', $expected)) !== FALSE, t('Form alter hooks executed in the expected order.'));
+ $this->assert(strpos($content, implode(' ', $expected)) !== FALSE, 'Form alter hooks executed in the expected order.');
}
}
@@ -364,8 +360,8 @@ class FormValidationTestCase extends DrupalWebTestCase {
'name' => 'element_validate',
);
$this->drupalPost(NULL, $edit, 'Save');
- $this->assertFieldByName('name', '#value changed by #element_validate', t('Form element #value was altered.'));
- $this->assertText('Name value: value changed by form_set_value() in #element_validate', t('Form element value in $form_state was altered.'));
+ $this->assertFieldByName('name', '#value changed by #element_validate', 'Form element #value was altered.');
+ $this->assertText('Name value: value changed by form_set_value() in #element_validate', 'Form element value in $form_state was altered.');
// Verify that #validate handlers can alter the form and submitted
// form values.
@@ -373,8 +369,8 @@ class FormValidationTestCase extends DrupalWebTestCase {
'name' => 'validate',
);
$this->drupalPost(NULL, $edit, 'Save');
- $this->assertFieldByName('name', '#value changed by #validate', t('Form element #value was altered.'));
- $this->assertText('Name value: value changed by form_set_value() in #validate', t('Form element value in $form_state was altered.'));
+ $this->assertFieldByName('name', '#value changed by #validate', 'Form element #value was altered.');
+ $this->assertText('Name value: value changed by form_set_value() in #validate', 'Form element value in $form_state was altered.');
// Verify that #element_validate handlers can make form elements
// inaccessible, but values persist.
@@ -383,12 +379,12 @@ class FormValidationTestCase extends DrupalWebTestCase {
);
$this->drupalPost(NULL, $edit, 'Save');
$this->assertNoFieldByName('name', t('Form element was hidden.'));
- $this->assertText('Name value: element_validate_access', t('Value for inaccessible form element exists.'));
+ $this->assertText('Name value: element_validate_access', 'Value for inaccessible form element exists.');
// Verify that value for inaccessible form element persists.
$this->drupalPost(NULL, array(), 'Save');
$this->assertNoFieldByName('name', t('Form element was hidden.'));
- $this->assertText('Name value: element_validate_access', t('Value for inaccessible form element exists.'));
+ $this->assertText('Name value: element_validate_access', 'Value for inaccessible form element exists.');
}
/**
@@ -440,49 +436,49 @@ class FormsElementsLabelsTestCase extends DrupalWebTestCase {
// Check that the checkbox/radio processing is not interfering with
// basic placement.
$elements = $this->xpath('//input[@id="edit-form-checkboxes-test-third-checkbox"]/following-sibling::label[@for="edit-form-checkboxes-test-third-checkbox" and @class="option"]');
- $this->assertTrue(isset($elements[0]), t("Label follows field and label option class correct for regular checkboxes."));
+ $this->assertTrue(isset($elements[0]), "Label follows field and label option class correct for regular checkboxes.");
$elements = $this->xpath('//input[@id="edit-form-radios-test-second-radio"]/following-sibling::label[@for="edit-form-radios-test-second-radio" and @class="option"]');
- $this->assertTrue(isset($elements[0]), t("Label follows field and label option class correct for regular radios."));
+ $this->assertTrue(isset($elements[0]), "Label follows field and label option class correct for regular radios.");
// Exercise various defaults for checkboxes and modifications to ensure
// appropriate override and correct behaviour.
$elements = $this->xpath('//input[@id="edit-form-checkbox-test"]/following-sibling::label[@for="edit-form-checkbox-test" and @class="option"]');
- $this->assertTrue(isset($elements[0]), t("Label follows field and label option class correct for a checkbox by default."));
+ $this->assertTrue(isset($elements[0]), "Label follows field and label option class correct for a checkbox by default.");
// Exercise various defaults for textboxes and modifications to ensure
// appropriate override and correct behaviour.
$elements = $this->xpath('//label[@for="edit-form-textfield-test-title-and-required"]/child::span[@class="form-required"]/parent::*/following-sibling::input[@id="edit-form-textfield-test-title-and-required"]');
- $this->assertTrue(isset($elements[0]), t("Label preceeds textfield, with required marker inside label."));
+ $this->assertTrue(isset($elements[0]), "Label preceeds textfield, with required marker inside label.");
$elements = $this->xpath('//input[@id="edit-form-textfield-test-no-title-required"]/preceding-sibling::label[@for="edit-form-textfield-test-no-title-required"]/span[@class="form-required"]');
- $this->assertTrue(isset($elements[0]), t("Label tag with required marker preceeds required textfield with no title."));
+ $this->assertTrue(isset($elements[0]), "Label tag with required marker preceeds required textfield with no title.");
$elements = $this->xpath('//input[@id="edit-form-textfield-test-title"]/preceding-sibling::span[@class="form-required"]');
- $this->assertFalse(isset($elements[0]), t("No required marker on non-required field."));
+ $this->assertFalse(isset($elements[0]), "No required marker on non-required field.");
$elements = $this->xpath('//input[@id="edit-form-textfield-test-title-after"]/following-sibling::label[@for="edit-form-textfield-test-title-after" and @class="option"]');
- $this->assertTrue(isset($elements[0]), t("Label after field and label option class correct for text field."));
+ $this->assertTrue(isset($elements[0]), "Label after field and label option class correct for text field.");
$elements = $this->xpath('//input[@id="edit-form-textfield-test-title-invisible"]/following-sibling::label[@for="edit-form-textfield-test-title-invisible" and @class="element-invisible"]');
- $this->assertTrue(isset($elements[0]), t("Label after field and label class is element-invisible."));
+ $this->assertTrue(isset($elements[0]), "Label after field and label class is element-invisible.");
$elements = $this->xpath('//label[@for="edit-form-textfield-test-title-no-show"]');
- $this->assertFalse(isset($elements[0]), t("No label tag when title set not to display."));
+ $this->assertFalse(isset($elements[0]), "No label tag when title set not to display.");
// Check #field_prefix and #field_suffix placement.
$elements = $this->xpath('//span[@class="field-prefix"]/following-sibling::div[@id="edit-form-radios-test"]');
- $this->assertTrue(isset($elements[0]), t("Properly placed the #field_prefix element after the label and before the field."));
+ $this->assertTrue(isset($elements[0]), "Properly placed the #field_prefix element after the label and before the field.");
$elements = $this->xpath('//span[@class="field-suffix"]/preceding-sibling::div[@id="edit-form-radios-test"]');
- $this->assertTrue(isset($elements[0]), t("Properly places the #field_suffix element immediately after the form field."));
+ $this->assertTrue(isset($elements[0]), "Properly places the #field_suffix element immediately after the form field.");
// Check #prefix and #suffix placement.
$elements = $this->xpath('//div[@id="form-test-textfield-title-prefix"]/following-sibling::div[contains(@class, \'form-item-form-textfield-test-title\')]');
- $this->assertTrue(isset($elements[0]), t("Properly places the #prefix element before the form item."));
+ $this->assertTrue(isset($elements[0]), "Properly places the #prefix element before the form item.");
$elements = $this->xpath('//div[@id="form-test-textfield-title-suffix"]/preceding-sibling::div[contains(@class, \'form-item-form-textfield-test-title\')]');
- $this->assertTrue(isset($elements[0]), t("Properly places the #suffix element before the form item."));
+ $this->assertTrue(isset($elements[0]), "Properly places the #suffix element before the form item.");
}
}
@@ -511,14 +507,14 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
$this->drupalGet('form_test/tableselect/multiple-true');
- $this->assertNoText(t('Empty text.'), t('Empty text should not be displayed.'));
+ $this->assertNoText(t('Empty text.'), 'Empty text should not be displayed.');
// Test for the presence of the Select all rows tableheader.
- $this->assertFieldByXPath('//th[@class="select-all"]', NULL, t('Presence of the "Select all" checkbox.'));
+ $this->assertFieldByXPath('//th[@class="select-all"]', NULL, 'Presence of the "Select all" checkbox.');
$rows = array('row1', 'row2', 'row3');
foreach ($rows as $row) {
- $this->assertFieldByXPath('//input[@type="checkbox"]', $row, t('Checkbox for value @row.', array('@row' => $row)));
+ $this->assertFieldByXPath('//input[@type="checkbox"]', $row, 'Checkbox for value ' . $row . '.');
}
}
@@ -528,14 +524,14 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
function testMultipleFalse() {
$this->drupalGet('form_test/tableselect/multiple-false');
- $this->assertNoText(t('Empty text.'), t('Empty text should not be displayed.'));
+ $this->assertNoText(t('Empty text.'), 'Empty text should not be displayed.');
// Test for the absence of the Select all rows tableheader.
- $this->assertNoFieldByXPath('//th[@class="select-all"]', '', t('Absence of the "Select all" checkbox.'));
+ $this->assertNoFieldByXPath('//th[@class="select-all"]', '', 'Absence of the "Select all" checkbox.');
$rows = array('row1', 'row2', 'row3');
foreach ($rows as $row) {
- $this->assertFieldByXPath('//input[@type="radio"]', $row, t('Radio button for value @row.', array('@row' => $row)));
+ $this->assertFieldByXPath('//input[@type="radio"]', $row, 'Radio button for value ' . $row . '.');
}
}
@@ -544,7 +540,7 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
*/
function testEmptyText() {
$this->drupalGet('form_test/tableselect/empty-text');
- $this->assertText(t('Empty text.'), t('Empty text should be displayed.'));
+ $this->assertText(t('Empty text.'), 'Empty text should be displayed.');
}
/**
@@ -557,18 +553,18 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
$edit['tableselect[row1]'] = TRUE;
$this->drupalPost('form_test/tableselect/multiple-true', $edit, 'Submit');
- $this->assertText(t('Submitted: row1 = row1'), t('Checked checkbox row1'));
- $this->assertText(t('Submitted: row2 = 0'), t('Unchecked checkbox row2.'));
- $this->assertText(t('Submitted: row3 = 0'), t('Unchecked checkbox row3.'));
+ $this->assertText(t('Submitted: row1 = row1'), 'Checked checkbox row1');
+ $this->assertText(t('Submitted: row2 = 0'), 'Unchecked checkbox row2.');
+ $this->assertText(t('Submitted: row3 = 0'), 'Unchecked checkbox row3.');
// Test a submission with multiple checkboxes checked.
$edit['tableselect[row1]'] = TRUE;
$edit['tableselect[row3]'] = TRUE;
$this->drupalPost('form_test/tableselect/multiple-true', $edit, 'Submit');
- $this->assertText(t('Submitted: row1 = row1'), t('Checked checkbox row1.'));
- $this->assertText(t('Submitted: row2 = 0'), t('Unchecked checkbox row2.'));
- $this->assertText(t('Submitted: row3 = row3'), t('Checked checkbox row3.'));
+ $this->assertText(t('Submitted: row1 = row1'), 'Checked checkbox row1.');
+ $this->assertText(t('Submitted: row2 = 0'), 'Unchecked checkbox row2.');
+ $this->assertText(t('Submitted: row3 = row3'), 'Checked checkbox row3.');
}
@@ -578,7 +574,7 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
function testMultipleFalseSubmit() {
$edit['tableselect'] = 'row1';
$this->drupalPost('form_test/tableselect/multiple-false', $edit, 'Submit');
- $this->assertText(t('Submitted: row1'), t('Selected radio button'));
+ $this->assertText(t('Submitted: row1'), 'Selected radio button');
}
/**
@@ -587,18 +583,18 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
function testAdvancedSelect() {
// When #multiple = TRUE a Select all checkbox should be displayed by default.
$this->drupalGet('form_test/tableselect/advanced-select/multiple-true-default');
- $this->assertFieldByXPath('//th[@class="select-all"]', NULL, t('Display a "Select all" checkbox by default when #multiple is TRUE.'));
+ $this->assertFieldByXPath('//th[@class="select-all"]', NULL, 'Display a "Select all" checkbox by default when #multiple is TRUE.');
// When #js_select is set to FALSE, a "Select all" checkbox should not be displayed.
$this->drupalGet('form_test/tableselect/advanced-select/multiple-true-no-advanced-select');
- $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, t('Do not display a "Select all" checkbox when #js_select is FALSE.'));
+ $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, 'Do not display a "Select all" checkbox when #js_select is FALSE.');
// A "Select all" checkbox never makes sense when #multiple = FALSE, regardless of the value of #js_select.
$this->drupalGet('form_test/tableselect/advanced-select/multiple-false-default');
- $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, t('Do not display a "Select all" checkbox when #multiple is FALSE.'));
+ $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, 'Do not display a "Select all" checkbox when #multiple is FALSE.');
$this->drupalGet('form_test/tableselect/advanced-select/multiple-false-advanced-select');
- $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, t('Do not display a "Select all" checkbox when #multiple is FALSE, even when #js_select is TRUE.'));
+ $this->assertNoFieldByXPath('//th[@class="select-all"]', NULL, 'Do not display a "Select all" checkbox when #multiple is FALSE, even when #js_select is TRUE.');
}
@@ -617,11 +613,11 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
// Test with a valid value.
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => 'row1'));
- $this->assertFalse(isset($errors['tableselect']), t('Option checker allows valid values for checkboxes.'));
+ $this->assertFalse(isset($errors['tableselect']), 'Option checker allows valid values for checkboxes.');
// Test with an invalid value.
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => 'non_existing_value'));
- $this->assertTrue(isset($errors['tableselect']), t('Option checker disallows invalid values for checkboxes.'));
+ $this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for checkboxes.');
}
@@ -642,11 +638,11 @@ class FormsElementsTableSelectFunctionalTest extends DrupalWebTestCase {
// Test with a valid value.
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => 'row1'));
- $this->assertFalse(isset($errors['tableselect']), t('Option checker allows valid values for radio buttons.'));
+ $this->assertFalse(isset($errors['tableselect']), 'Option checker allows valid values for radio buttons.');
// Test with an invalid value.
list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => 'non_existing_value'));
- $this->assertTrue(isset($errors['tableselect']), t('Option checker disallows invalid values for radio buttons.'));
+ $this->assertTrue(isset($errors['tableselect']), 'Option checker disallows invalid values for radio buttons.');
}
@@ -739,7 +735,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, 'Save');
$this->assertText('Form constructions: 5');
- $this->assertText('Title: new', t('The form storage has stored the values.'));
+ $this->assertText('Title: new', 'The form storage has stored the values.');
}
/**
@@ -766,7 +762,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, 'Save');
$this->assertText('Form constructions: 3');
- $this->assertText('Title: new', t('The form storage has stored the values.'));
+ $this->assertText('Title: new', 'The form storage has stored the values.');
}
/**
@@ -774,7 +770,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
*/
function testValidation() {
$this->drupalPost('form_test/form-storage', array('title' => '', 'value' => 'value_is_set'), 'Continue submit');
- $this->assertPattern('/value_is_set/', t('The input values have been kept.'));
+ $this->assertPattern('/value_is_set/', 'The input values have been kept.');
}
/**
@@ -824,7 +820,7 @@ class FormsFormStorageTestCase extends DrupalWebTestCase {
array(),
array('query' => array('cache' => 1)),
);
- foreach($run_options as $options) {
+ foreach ($run_options as $options) {
$this->drupalPost('form-test/state-persist', array(), t('Submit'), $options);
// The submit handler outputs the value in $form_state, assert it's there.
$this->assertText('State persisted.');
@@ -864,8 +860,8 @@ class FormsFormWrapperTestCase extends DrupalWebTestCase {
*/
function testWrapperCallback() {
$this->drupalGet('form_test/wrapper-callback');
- $this->assertText('Form wrapper callback element output.', t('The form contains form wrapper elements.'));
- $this->assertText('Form builder element output.', t('The form contains form builder elements.'));
+ $this->assertText('Form wrapper callback element output.', 'The form contains form wrapper elements.');
+ $this->assertText('Form builder element output.', 'The form contains form builder elements.');
}
}
@@ -898,22 +894,22 @@ class FormStateValuesCleanTestCase extends DrupalWebTestCase {
);
// Verify that all internal Form API elements were removed.
- $this->assertFalse(isset($values['form_id']), t('%element was removed.', array('%element' => 'form_id')));
- $this->assertFalse(isset($values['form_token']), t('%element was removed.', array('%element' => 'form_token')));
- $this->assertFalse(isset($values['form_build_id']), t('%element was removed.', array('%element' => 'form_build_id')));
- $this->assertFalse(isset($values['op']), t('%element was removed.', array('%element' => 'op')));
+ $this->assertFalse(isset($values['form_id']), 'form_id' . ' was removed.');
+ $this->assertFalse(isset($values['form_token']), 'form_token' . ' was removed.');
+ $this->assertFalse(isset($values['form_build_id']), 'form_build_id' . ' was removed.');
+ $this->assertFalse(isset($values['op']), 'op' . ' was removed.');
// Verify that all buttons were removed.
- $this->assertFalse(isset($values['foo']), t('%element was removed.', array('%element' => 'foo')));
- $this->assertFalse(isset($values['bar']), t('%element was removed.', array('%element' => 'bar')));
- $this->assertFalse(isset($values['baz']['foo']), t('%element was removed.', array('%element' => 'foo')));
- $this->assertFalse(isset($values['baz']['baz']), t('%element was removed.', array('%element' => 'baz')));
+ $this->assertFalse(isset($values['foo']), 'foo' . ' was removed.');
+ $this->assertFalse(isset($values['bar']), 'bar' . ' was removed.');
+ $this->assertFalse(isset($values['baz']['foo']), 'foo' . ' was removed.');
+ $this->assertFalse(isset($values['baz']['baz']), 'baz' . ' was removed.');
// Verify that nested form value still exists.
- $this->assertTrue(isset($values['baz']['beer']), t('Nested form value still exists.'));
+ $this->assertTrue(isset($values['baz']['beer']), 'Nested form value still exists.');
// Verify that actual form values equal resulting form values.
- $this->assertEqual($values, $result, t('Expected form values equal actual form values.'));
+ $this->assertEqual($values, $result, 'Expected form values equal actual form values.');
}
}
@@ -950,14 +946,14 @@ class FormsRebuildTestCase extends DrupalWebTestCase {
$this->drupalPost('form-test/form-rebuild-preserve-values', $edit, 'Add more');
// Verify that initial elements retained their submitted values.
- $this->assertFieldChecked('edit-checkbox-1-default-off', t('A submitted checked checkbox retained its checked state during a rebuild.'));
- $this->assertNoFieldChecked('edit-checkbox-1-default-on', t('A submitted unchecked checkbox retained its unchecked state during a rebuild.'));
- $this->assertFieldById('edit-text-1', 'foo', t('A textfield retained its submitted value during a rebuild.'));
+ $this->assertFieldChecked('edit-checkbox-1-default-off', 'A submitted checked checkbox retained its checked state during a rebuild.');
+ $this->assertNoFieldChecked('edit-checkbox-1-default-on', 'A submitted unchecked checkbox retained its unchecked state during a rebuild.');
+ $this->assertFieldById('edit-text-1', 'foo', 'A textfield retained its submitted value during a rebuild.');
// Verify that newly added elements were initialized with their default values.
- $this->assertFieldChecked('edit-checkbox-2-default-on', t('A newly added checkbox was initialized with a default checked state.'));
- $this->assertNoFieldChecked('edit-checkbox-2-default-off', t('A newly added checkbox was initialized with a default unchecked state.'));
- $this->assertFieldById('edit-text-2', 'DEFAULT 2', t('A newly added textfield was initialized with its default value.'));
+ $this->assertFieldChecked('edit-checkbox-2-default-on', 'A newly added checkbox was initialized with a default checked state.');
+ $this->assertNoFieldChecked('edit-checkbox-2-default-off', 'A newly added checkbox was initialized with a default unchecked state.');
+ $this->assertFieldById('edit-text-2', 'DEFAULT 2', 'A newly added textfield was initialized with its default value.');
}
/**
@@ -995,7 +991,7 @@ class FormsRebuildTestCase extends DrupalWebTestCase {
$button = $this->xpath('//input[@name="field_ajax_test_add_more"]');
$button_id = (string) $button[0]['id'];
$this->drupalPostAJAX(NULL, array(), array('field_ajax_test_add_more' => t('Add another item')), 'system/ajax', array(), array(), 'page-node-form', $settings['ajax'][$button_id]);
- $this->assert(count($this->xpath('//div[contains(@class, "field-name-field-ajax-test")]//input[@type="text"]')) == 2, t('AJAX submission succeeded.'));
+ $this->assert(count($this->xpath('//div[contains(@class, "field-name-field-ajax-test")]//input[@type="text"]')) == 2, 'AJAX submission succeeded.');
// Submit the form with the non-AJAX "Save" button, leaving the title field
// blank to trigger a validation error, and ensure that a validation error
@@ -1003,11 +999,11 @@ class FormsRebuildTestCase extends DrupalWebTestCase {
// re-rendered without being re-built, which is what happens when there's
// a validation error.
$this->drupalPost(NULL, array(), t('Save'));
- $this->assertText('Title field is required.', t('Non-AJAX submission correctly triggered a validation error.'));
+ $this->assertText('Title field is required.', 'Non-AJAX submission correctly triggered a validation error.');
// Ensure that the form's action is correct.
$forms = $this->xpath('//form[contains(@class, "node-page-form")]');
- $this->assert(count($forms) == 1 && $forms[0]['action'] == url('node/add/page'), t('Re-rendered form contains the correct action value.'));
+ $this->assert(count($forms) == 1 && $forms[0]['action'] == url('node/add/page'), 'Re-rendered form contains the correct action value.');
}
}
@@ -1034,7 +1030,7 @@ class FormsProgrammaticTestCase extends DrupalWebTestCase {
function testSubmissionWorkflow() {
// Backup the current batch status and reset it to avoid conflicts while
// processing the dummy form submit handler.
- $current_batch = $batch =& batch_get();
+ $current_batch = $batch = & batch_get();
$batch = array();
// Test that a programmatic form submission is rejected when a required
@@ -1077,7 +1073,7 @@ class FormsProgrammaticTestCase extends DrupalWebTestCase {
'%values' => print_r($values, TRUE),
'%errors' => $valid_form ? t('None') : implode(' ', $errors),
);
- $this->assertTrue($valid_input == $valid_form, t('Input values: %values<br/>Validation handler errors: %errors', $args));
+ $this->assertTrue($valid_input == $valid_form, 'Input values: ' . $args['%values'] . '<br/>Validation handler errors: ' . $args['%errors']);
// We check submitted values only if we have a valid input.
if ($valid_input) {
@@ -1085,7 +1081,7 @@ class FormsProgrammaticTestCase extends DrupalWebTestCase {
// submission handler was properly executed.
$stored_values = $form_state['storage']['programmatic_form_submit'];
foreach ($values as $key => $value) {
- $this->assertTrue(isset($stored_values[$key]) && $stored_values[$key] == $value, t('Submission handler correctly executed: %stored_key is %stored_value', array('%stored_key' => $key, '%stored_value' => print_r($value, TRUE))));
+ $this->assertTrue(isset($stored_values[$key]) && $stored_values[$key] == $value, 'Submission handler correctly executed: ' . $key . ' is ' . print_r($value, TRUE));
}
}
}
@@ -1122,24 +1118,24 @@ class FormsTriggeringElementTestCase extends DrupalWebTestCase {
// $form_state['triggering_element'] and the form submit handler not
// running.
$this->drupalPost($path, $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('There is no clicked button.', t('$form_state[\'triggering_element\'] set to NULL.'));
- $this->assertNoText('Submit handler for form_test_clicked_button executed.', t('Form submit handler did not execute.'));
+ $this->assertText('There is no clicked button.', '$form_state[\'triggering_element\'] set to NULL.');
+ $this->assertNoText('Submit handler for form_test_clicked_button executed.', 'Form submit handler did not execute.');
// Ensure submitting a form with one or more submit buttons results in
// $form_state['triggering_element'] being set to the first one the user has
// access to. An argument with 'r' in it indicates a restricted
// (#access=FALSE) button.
$this->drupalPost($path . '/s', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button1.', t('$form_state[\'triggering_element\'] set to only button.'));
- $this->assertText('Submit handler for form_test_clicked_button executed.', t('Form submit handler executed.'));
+ $this->assertText('The clicked button is button1.', '$form_state[\'triggering_element\'] set to only button.');
+ $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.');
$this->drupalPost($path . '/s/s', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button1.', t('$form_state[\'triggering_element\'] set to first button.'));
- $this->assertText('Submit handler for form_test_clicked_button executed.', t('Form submit handler executed.'));
+ $this->assertText('The clicked button is button1.', '$form_state[\'triggering_element\'] set to first button.');
+ $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.');
$this->drupalPost($path . '/rs/s', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button2.', t('$form_state[\'triggering_element\'] set to first available button.'));
- $this->assertText('Submit handler for form_test_clicked_button executed.', t('Form submit handler executed.'));
+ $this->assertText('The clicked button is button2.', '$form_state[\'triggering_element\'] set to first available button.');
+ $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.');
// Ensure submitting a form with buttons of different types results in
// $form_state['triggering_element'] being set to the first button,
@@ -1147,16 +1143,16 @@ class FormsTriggeringElementTestCase extends DrupalWebTestCase {
// submit handler not executing. The types are 's'(ubmit), 'b'(utton), and
// 'i'(mage_button).
$this->drupalPost($path . '/s/b/i', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button1.', t('$form_state[\'triggering_element\'] set to first button.'));
- $this->assertText('Submit handler for form_test_clicked_button executed.', t('Form submit handler executed.'));
+ $this->assertText('The clicked button is button1.', '$form_state[\'triggering_element\'] set to first button.');
+ $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.');
$this->drupalPost($path . '/b/s/i', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button1.', t('$form_state[\'triggering_element\'] set to first button.'));
- $this->assertNoText('Submit handler for form_test_clicked_button executed.', t('Form submit handler did not execute.'));
+ $this->assertText('The clicked button is button1.', '$form_state[\'triggering_element\'] set to first button.');
+ $this->assertNoText('Submit handler for form_test_clicked_button executed.', 'Form submit handler did not execute.');
$this->drupalPost($path . '/i/s/b', $edit, NULL, array(), array(), $form_html_id);
- $this->assertText('The clicked button is button1.', t('$form_state[\'triggering_element\'] set to first button.'));
- $this->assertText('Submit handler for form_test_clicked_button executed.', t('Form submit handler executed.'));
+ $this->assertText('The clicked button is button1.', '$form_state[\'triggering_element\'] set to first button.');
+ $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.');
}
/**
@@ -1184,8 +1180,8 @@ class FormsTriggeringElementTestCase extends DrupalWebTestCase {
// because negative assertions alone can be brittle. See
// testNoButtonInfoInPost() for why the triggering element gets set to
// 'button2'.
- $this->assertNoText('The clicked button is button1.', t('$form_state[\'triggering_element\'] not set to a restricted button.'));
- $this->assertText('The clicked button is button2.', t('$form_state[\'triggering_element\'] not set to a restricted button.'));
+ $this->assertNoText('The clicked button is button1.', '$form_state[\'triggering_element\'] not set to a restricted button.');
+ $this->assertText('The clicked button is button2.', '$form_state[\'triggering_element\'] not set to a restricted button.');
}
}
diff --git a/modules/simpletest/tests/graph.test b/modules/simpletest/tests/graph.test
index 70af3ff1e..aad60f81d 100644
--- a/modules/simpletest/tests/graph.test
+++ b/modules/simpletest/tests/graph.test
@@ -68,7 +68,7 @@ class GraphUnitTest extends DrupalUnitTestCase {
$this->assertReversePaths($graph, $expected_reverse_paths);
// Assert that DFS didn't created "missing" vertexes automatically.
- $this->assertFALSE(isset($graph[6]), t('Vertex 6 has not been created'));
+ $this->assertFALSE(isset($graph[6]), 'Vertex 6 has not been created');
$expected_components = array(
array(1, 2, 3, 4, 5, 7),
@@ -114,7 +114,7 @@ class GraphUnitTest extends DrupalUnitTestCase {
// Build an array with keys = $paths and values = TRUE.
$expected = array_fill_keys($paths, TRUE);
$result = isset($graph[$vertex]['paths']) ? $graph[$vertex]['paths'] : array();
- $this->assertEqual($expected, $result, t('Expected paths for vertex @vertex: @expected-paths, got @paths', array('@vertex' => $vertex, '@expected-paths' => $this->displayArray($expected, TRUE), '@paths' => $this->displayArray($result, TRUE))));
+ $this->assertEqual($expected, $result, 'Expected paths for vertex ' . $vertex . ': ' . $this->displayArray($expected, TRUE) . ', got ' . $this->displayArray($result, TRUE));
}
}
@@ -132,7 +132,7 @@ class GraphUnitTest extends DrupalUnitTestCase {
// Build an array with keys = $paths and values = TRUE.
$expected = array_fill_keys($paths, TRUE);
$result = isset($graph[$vertex]['reverse_paths']) ? $graph[$vertex]['reverse_paths'] : array();
- $this->assertEqual($expected, $result, t('Expected reverse paths for vertex @vertex: @expected-paths, got @paths', array('@vertex' => $vertex, '@expected-paths' => $this->displayArray($expected, TRUE), '@paths' => $this->displayArray($result, TRUE))));
+ $this->assertEqual($expected, $result, 'Expected reverse paths for vertex ' . $vertex . ': ' . $this->displayArray($expected, TRUE) . ', got ' . $this->displayArray($result, TRUE));
}
}
@@ -152,9 +152,9 @@ class GraphUnitTest extends DrupalUnitTestCase {
$result_components[] = $graph[$vertex]['component'];
unset($unassigned_vertices[$vertex]);
}
- $this->assertEqual(1, count(array_unique($result_components)), t('Expected one unique component for vertices @vertices, got @components', array('@vertices' => $this->displayArray($component), '@components' => $this->displayArray($result_components))));
+ $this->assertEqual(1, count(array_unique($result_components)), 'Expected one unique component for vertices ' . $this->displayArray($component) . ', got ' . $this->displayArray($result_components));
}
- $this->assertEqual(array(), $unassigned_vertices, t('Vertices not assigned to a component: @vertices', array('@vertices' => $this->displayArray($unassigned_vertices, TRUE))));
+ $this->assertEqual(array(), $unassigned_vertices, 'Vertices not assigned to a component: ' . $this->displayArray($unassigned_vertices, TRUE));
}
/**
@@ -169,7 +169,7 @@ class GraphUnitTest extends DrupalUnitTestCase {
foreach ($expected_orders as $order) {
$previous_vertex = array_shift($order);
foreach ($order as $vertex) {
- $this->assertTrue($graph[$previous_vertex]['weight'] < $graph[$vertex]['weight'], t('Weights of @previous-vertex and @vertex are correct relative to each other', array('@previous-vertex' => $previous_vertex, '@vertex' => $vertex)));
+ $this->assertTrue($graph[$previous_vertex]['weight'] < $graph[$vertex]['weight'], 'Weights of ' . $previous_vertex . ' and ' . $vertex . ' are correct relative to each other');
}
}
}
diff --git a/modules/simpletest/tests/image.test b/modules/simpletest/tests/image.test
index d448d4876..89729d0fc 100644
--- a/modules/simpletest/tests/image.test
+++ b/modules/simpletest/tests/image.test
@@ -50,19 +50,19 @@ class ImageToolkitTestCase extends DrupalWebTestCase {
// Determine if there were any expected that were not called.
$uncalled = array_diff($expected, $actual);
if (count($uncalled)) {
- $this->assertTrue(FALSE, t('Expected operations %expected to be called but %uncalled was not called.', array('%expected' => implode(', ', $expected), '%uncalled' => implode(', ', $uncalled))));
+ $this->assertTrue(FALSE, 'Expected operations ' . implode(', ', $expected) . ' to be called but ' . implode(', ', $uncalled) . ' was not called.');
}
else {
- $this->assertTrue(TRUE, t('All the expected operations were called: %expected', array('%expected' => implode(', ', $expected))));
+ $this->assertTrue(TRUE, 'All the expected operations were called: ' . implode(', ', $expected));
}
// Determine if there were any unexpected calls.
$unexpected = array_diff($actual, $expected);
if (count($unexpected)) {
- $this->assertTrue(FALSE, t('Unexpected operations were called: %unexpected.', array('%unexpected' => implode(', ', $unexpected))));
+ $this->assertTrue(FALSE, 'Unexpected operations were called: ' . implode(', ', $unexpected) . '.');
}
else {
- $this->assertTrue(TRUE, t('No unexpected operations were called.'));
+ $this->assertTrue(TRUE, 'No unexpected operations were called.');
}
}
}
@@ -85,8 +85,8 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase {
*/
function testGetAvailableToolkits() {
$toolkits = image_get_available_toolkits();
- $this->assertTrue(isset($toolkits['test']), t('The working toolkit was returned.'));
- $this->assertFalse(isset($toolkits['broken']), t('The toolkit marked unavailable was not returned'));
+ $this->assertTrue(isset($toolkits['test']), 'The working toolkit was returned.');
+ $this->assertFalse(isset($toolkits['broken']), 'The toolkit marked unavailable was not returned');
$this->assertToolkitOperationsCalled(array());
}
@@ -95,8 +95,8 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase {
*/
function testLoad() {
$image = image_load($this->file, $this->toolkit);
- $this->assertTrue(is_object($image), t('Returned an object.'));
- $this->assertEqual($this->toolkit, $image->toolkit, t('Image had toolkit set.'));
+ $this->assertTrue(is_object($image), 'Returned an object.');
+ $this->assertEqual($this->toolkit, $image->toolkit, 'Image had toolkit set.');
$this->assertToolkitOperationsCalled(array('load', 'get_info'));
}
@@ -104,7 +104,7 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase {
* Test the image_save() function.
*/
function testSave() {
- $this->assertFalse(image_save($this->image), t('Function returned the expected value.'));
+ $this->assertFalse(image_save($this->image), 'Function returned the expected value.');
$this->assertToolkitOperationsCalled(array('save'));
}
@@ -112,83 +112,83 @@ class ImageToolkitUnitTest extends ImageToolkitTestCase {
* Test the image_resize() function.
*/
function testResize() {
- $this->assertTrue(image_resize($this->image, 1, 2), t('Function returned the expected value.'));
+ $this->assertTrue(image_resize($this->image, 1, 2), 'Function returned the expected value.');
$this->assertToolkitOperationsCalled(array('resize'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['resize'][0][1], 1, t('Width was passed correctly'));
- $this->assertEqual($calls['resize'][0][2], 2, t('Height was passed correctly'));
+ $this->assertEqual($calls['resize'][0][1], 1, 'Width was passed correctly');
+ $this->assertEqual($calls['resize'][0][2], 2, 'Height was passed correctly');
}
/**
* Test the image_scale() function.
*/
function testScale() {
-// TODO: need to test upscaling
- $this->assertTrue(image_scale($this->image, 10, 10), t('Function returned the expected value.'));
+ // TODO: need to test upscaling
+ $this->assertTrue(image_scale($this->image, 10, 10), 'Function returned the expected value.');
$this->assertToolkitOperationsCalled(array('resize'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['resize'][0][1], 10, t('Width was passed correctly'));
- $this->assertEqual($calls['resize'][0][2], 5, t('Height was based off aspect ratio and passed correctly'));
+ $this->assertEqual($calls['resize'][0][1], 10, 'Width was passed correctly');
+ $this->assertEqual($calls['resize'][0][2], 5, 'Height was based off aspect ratio and passed correctly');
}
/**
* Test the image_scale_and_crop() function.
*/
function testScaleAndCrop() {
- $this->assertTrue(image_scale_and_crop($this->image, 5, 10), t('Function returned the expected value.'));
+ $this->assertTrue(image_scale_and_crop($this->image, 5, 10), 'Function returned the expected value.');
$this->assertToolkitOperationsCalled(array('resize', 'crop'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['crop'][0][1], 7.5, t('X was computed and passed correctly'));
- $this->assertEqual($calls['crop'][0][2], 0, t('Y was computed and passed correctly'));
- $this->assertEqual($calls['crop'][0][3], 5, t('Width was computed and passed correctly'));
- $this->assertEqual($calls['crop'][0][4], 10, t('Height was computed and passed correctly'));
+ $this->assertEqual($calls['crop'][0][1], 7.5, 'X was computed and passed correctly');
+ $this->assertEqual($calls['crop'][0][2], 0, 'Y was computed and passed correctly');
+ $this->assertEqual($calls['crop'][0][3], 5, 'Width was computed and passed correctly');
+ $this->assertEqual($calls['crop'][0][4], 10, 'Height was computed and passed correctly');
}
/**
* Test the image_rotate() function.
*/
function testRotate() {
- $this->assertTrue(image_rotate($this->image, 90, 1), t('Function returned the expected value.'));
+ $this->assertTrue(image_rotate($this->image, 90, 1), 'Function returned the expected value.');
$this->assertToolkitOperationsCalled(array('rotate'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['rotate'][0][1], 90, t('Degrees were passed correctly'));
- $this->assertEqual($calls['rotate'][0][2], 1, t('Background color was passed correctly'));
+ $this->assertEqual($calls['rotate'][0][1], 90, 'Degrees were passed correctly');
+ $this->assertEqual($calls['rotate'][0][2], 1, 'Background color was passed correctly');
}
/**
* Test the image_crop() function.
*/
function testCrop() {
- $this->assertTrue(image_crop($this->image, 1, 2, 3, 4), t('Function returned the expected value.'));
+ $this->assertTrue(image_crop($this->image, 1, 2, 3, 4), 'Function returned the expected value.');
$this->assertToolkitOperationsCalled(array('crop'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual($calls['crop'][0][1], 1, t('X was passed correctly'));
- $this->assertEqual($calls['crop'][0][2], 2, t('Y was passed correctly'));
- $this->assertEqual($calls['crop'][0][3], 3, t('Width was passed correctly'));
- $this->assertEqual($calls['crop'][0][4], 4, t('Height was passed correctly'));
+ $this->assertEqual($calls['crop'][0][1], 1, 'X was passed correctly');
+ $this->assertEqual($calls['crop'][0][2], 2, 'Y was passed correctly');
+ $this->assertEqual($calls['crop'][0][3], 3, 'Width was passed correctly');
+ $this->assertEqual($calls['crop'][0][4], 4, 'Height was passed correctly');
}
/**
* Test the image_desaturate() function.
*/
function testDesaturate() {
- $this->assertTrue(image_desaturate($this->image), t('Function returned the expected value.'));
+ $this->assertTrue(image_desaturate($this->image), 'Function returned the expected value.');
$this->assertToolkitOperationsCalled(array('desaturate'));
// Check the parameters.
$calls = image_test_get_all_calls();
- $this->assertEqual(count($calls['desaturate'][0]), 1, t('Only the image was passed.'));
+ $this->assertEqual(count($calls['desaturate'][0]), 1, 'Only the image was passed.');
}
}
@@ -257,7 +257,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
function testManipulations() {
// If GD isn't available don't bother testing this.
if (!function_exists('image_gd_check_settings') || !image_gd_check_settings()) {
- $this->pass(t('Image manipulations for the GD toolkit were skipped because the GD toolkit is not available.'));
+ $this->pass('Image manipulations for the GD toolkit were skipped because the GD toolkit is not available.');
return;
}
@@ -385,7 +385,7 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
// Load up a fresh image.
$image = image_load(drupal_get_path('module', 'simpletest') . '/files/' . $file, 'gd');
if (!$image) {
- $this->fail(t('Could not load image %file.', array('%file' => $file)));
+ $this->fail('Could not load image ' . $file . '.');
continue 2;
}
@@ -448,11 +448,11 @@ class ImageToolkitGdTestCase extends DrupalWebTestCase {
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
image_save($image, $directory . '/' . $op . '.' . $image->info['extension']);
- $this->assertTrue($correct_dimensions_real, t('Image %file after %action action has proper dimensions.', array('%file' => $file, '%action' => $op)));
- $this->assertTrue($correct_dimensions_object, t('Image %file object after %action action is reporting the proper height and width values.', array('%file' => $file, '%action' => $op)));
+ $this->assertTrue($correct_dimensions_real, 'Image ' . $file . ' after ' . $op . ' action has proper dimensions.');
+ $this->assertTrue($correct_dimensions_object, 'Image ' . $file . ' object after ' . $op . ' action is reporting the proper height and width values.');
// JPEG colors will always be messed up due to compression.
if ($image->info['extension'] != 'jpg') {
- $this->assertTrue($correct_colors, t('Image %file object after %action action has the correct color placement.', array('%file' => $file, '%action' => $op)));
+ $this->assertTrue($correct_colors, 'Image ' . $file . ' object after ' . $op . ' action has the correct color placement.');
}
}
}
diff --git a/modules/simpletest/tests/lock.test b/modules/simpletest/tests/lock.test
index d9fc53f75..815dd6065 100644
--- a/modules/simpletest/tests/lock.test
+++ b/modules/simpletest/tests/lock.test
@@ -24,35 +24,35 @@ class LockFunctionalTest extends DrupalWebTestCase {
function testLockAcquire() {
$lock_acquired = 'TRUE: Lock successfully acquired in system_test_lock_acquire()';
$lock_not_acquired = 'FALSE: Lock not acquired in system_test_lock_acquire()';
- $this->assertTrue(lock_acquire('system_test_lock_acquire'), t('Lock acquired by this request.'), t('Lock'));
- $this->assertTrue(lock_acquire('system_test_lock_acquire'), t('Lock extended by this request.'), t('Lock'));
+ $this->assertTrue(lock_acquire('system_test_lock_acquire'), 'Lock acquired by this request.', 'Lock');
+ $this->assertTrue(lock_acquire('system_test_lock_acquire'), 'Lock extended by this request.', 'Lock');
lock_release('system_test_lock_acquire');
// Cause another request to acquire the lock.
$this->drupalGet('system-test/lock-acquire');
- $this->assertText($lock_acquired, t('Lock acquired by the other request.'), t('Lock'));
+ $this->assertText($lock_acquired, 'Lock acquired by the other request.', 'Lock');
// The other request has finished, thus it should have released its lock.
- $this->assertTrue(lock_acquire('system_test_lock_acquire'), t('Lock acquired by this request.'), t('Lock'));
+ $this->assertTrue(lock_acquire('system_test_lock_acquire'), 'Lock acquired by this request.', 'Lock');
// This request holds the lock, so the other request cannot acquire it.
$this->drupalGet('system-test/lock-acquire');
- $this->assertText($lock_not_acquired, t('Lock not acquired by the other request.'), t('Lock'));
+ $this->assertText($lock_not_acquired, 'Lock not acquired by the other request.', 'Lock');
lock_release('system_test_lock_acquire');
// Try a very short timeout and lock breaking.
- $this->assertTrue(lock_acquire('system_test_lock_acquire', 0.5), t('Lock acquired by this request.'), t('Lock'));
+ $this->assertTrue(lock_acquire('system_test_lock_acquire', 0.5), 'Lock acquired by this request.', 'Lock');
sleep(1);
// The other request should break our lock.
$this->drupalGet('system-test/lock-acquire');
- $this->assertText($lock_acquired, t('Lock acquired by the other request, breaking our lock.'), t('Lock'));
+ $this->assertText($lock_acquired, 'Lock acquired by the other request, breaking our lock.', 'Lock');
// We cannot renew it, since the other thread took it.
- $this->assertFalse(lock_acquire('system_test_lock_acquire'), t('Lock cannot be extended by this request.'), t('Lock'));
+ $this->assertFalse(lock_acquire('system_test_lock_acquire'), 'Lock cannot be extended by this request.', 'Lock');
// Check the shut-down function.
$lock_acquired_exit = 'TRUE: Lock successfully acquired in system_test_lock_exit()';
$lock_not_acquired_exit = 'FALSE: Lock not acquired in system_test_lock_exit()';
$this->drupalGet('system-test/lock-exit');
- $this->assertText($lock_acquired_exit, t('Lock acquired by the other request before exit.'), t('Lock'));
- $this->assertTrue(lock_acquire('system_test_lock_exit'), t('Lock acquired by this request after the other request exits.'), t('Lock'));
+ $this->assertText($lock_acquired_exit, 'Lock acquired by the other request before exit.', 'Lock');
+ $this->assertTrue(lock_acquire('system_test_lock_exit'), 'Lock acquired by this request after the other request exits.', 'Lock');
}
}
diff --git a/modules/simpletest/tests/mail.test b/modules/simpletest/tests/mail.test
index 48b61c3c7..c8b586605 100644
--- a/modules/simpletest/tests/mail.test
+++ b/modules/simpletest/tests/mail.test
@@ -38,7 +38,7 @@ class MailTestCase extends DrupalWebTestCase implements MailSystemInterface {
$message = drupal_mail('simpletest', 'mail_test', 'testing@drupal.org', $language);
// Assert whether the message was sent through the send function.
- $this->assertEqual(self::$sent_message['to'], 'testing@drupal.org', t('Pluggable mail system is extendable.'));
+ $this->assertEqual(self::$sent_message['to'], 'testing@drupal.org', 'Pluggable mail system is extendable.');
}
/**
diff --git a/modules/simpletest/tests/menu.test b/modules/simpletest/tests/menu.test
index 3fd90efc2..b24daf354 100644
--- a/modules/simpletest/tests/menu.test
+++ b/modules/simpletest/tests/menu.test
@@ -30,8 +30,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testTitleCallbackFalse() {
$this->drupalGet('node');
- $this->assertText('A title with @placeholder', t('Raw text found on the page'));
- $this->assertNoText(t('A title with @placeholder', array('@placeholder' => 'some other text')), t('Text with placeholder substitutions not found.'));
+ $this->assertText('A title with @placeholder', 'Raw text found on the page');
+ $this->assertNoText(t('A title with @placeholder', array('@placeholder' => 'some other text')), 'Text with placeholder substitutions not found.');
}
/**
@@ -39,8 +39,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testThemeCallbackAdministrative() {
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
- $this->assertText('Custom theme: seven. Actual theme: seven.', t('The administrative theme can be correctly set in a theme callback.'));
- $this->assertRaw('seven/style.css', t("The administrative theme's CSS appears on the page."));
+ $this->assertText('Custom theme: seven. Actual theme: seven.', 'The administrative theme can be correctly set in a theme callback.');
+ $this->assertRaw('seven/style.css', "The administrative theme's CSS appears on the page.");
}
/**
@@ -48,8 +48,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testThemeCallbackInheritance() {
$this->drupalGet('menu-test/theme-callback/use-admin-theme/inheritance');
- $this->assertText('Custom theme: seven. Actual theme: seven. Theme callback inheritance is being tested.', t('Theme callback inheritance correctly uses the administrative theme.'));
- $this->assertRaw('seven/style.css', t("The administrative theme's CSS appears on the page."));
+ $this->assertText('Custom theme: seven. Actual theme: seven. Theme callback inheritance is being tested.', 'Theme callback inheritance correctly uses the administrative theme.');
+ $this->assertRaw('seven/style.css', "The administrative theme's CSS appears on the page.");
}
/**
@@ -58,7 +58,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testFileInheritance() {
$this->drupalGet('admin/config/development/file-inheritance');
- $this->assertText('File inheritance test description', t('File inheritance works.'));
+ $this->assertText('File inheritance test description', 'File inheritance works.');
}
/**
@@ -81,14 +81,14 @@ class MenuRouterTestCase extends DrupalWebTestCase {
// For a regular user, the fact that the site is in maintenance mode means
// we expect the theme callback system to be bypassed entirely.
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
- $this->assertRaw('garland/style.css', t("The maintenance theme's CSS appears on the page."));
+ $this->assertRaw('garland/style.css', "The maintenance theme's CSS appears on the page.");
// An administrator, however, should continue to see the requested theme.
$admin_user = $this->drupalCreateUser(array('access site in maintenance mode'));
$this->drupalLogin($admin_user);
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
- $this->assertText('Custom theme: seven. Actual theme: seven.', t('The theme callback system is correctly triggered for an administrator when the site is in maintenance mode.'));
- $this->assertRaw('seven/style.css', t("The administrative theme's CSS appears on the page."));
+ $this->assertText('Custom theme: seven. Actual theme: seven.', 'The theme callback system is correctly triggered for an administrator when the site is in maintenance mode.');
+ $this->assertRaw('seven/style.css', "The administrative theme's CSS appears on the page.");
}
/**
@@ -104,7 +104,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$this->drupalGet('node');
$this->assertText($offline_message);
$this->drupalGet('menu_login_callback');
- $this->assertText('This is menu_login_callback().', t('Maintenance mode can be bypassed through hook_login_paths().'));
+ $this->assertText('This is menu_login_callback().', 'Maintenance mode can be bypassed through hook_login_paths().');
}
/**
@@ -117,11 +117,11 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$this->DrupalGet('user/login');
// Check that we got to 'user'.
- $this->assertTrue($this->url == url('user', array('absolute' => TRUE)), t("Logged-in user redirected to q=user on accessing q=user/login"));
+ $this->assertTrue($this->url == url('user', array('absolute' => TRUE)), "Logged-in user redirected to q=user on accessing q=user/login");
// user/register should redirect to user/UID/edit.
$this->DrupalGet('user/register');
- $this->assertTrue($this->url == url('user/' . $this->loggedInUser->uid . '/edit', array('absolute' => TRUE)), t("Logged-in user redirected to q=user/UID/edit on accessing q=user/register"));
+ $this->assertTrue($this->url == url('user/' . $this->loggedInUser->uid . '/edit', array('absolute' => TRUE)), "Logged-in user redirected to q=user/UID/edit on accessing q=user/register");
}
/**
@@ -130,14 +130,14 @@ class MenuRouterTestCase extends DrupalWebTestCase {
function testThemeCallbackOptionalTheme() {
// Request a theme that is not enabled.
$this->drupalGet('menu-test/theme-callback/use-stark-theme');
- $this->assertText('Custom theme: NONE. Actual theme: garland.', t('The theme callback system falls back on the default theme when a theme that is not enabled is requested.'));
- $this->assertRaw('garland/style.css', t("The default theme's CSS appears on the page."));
+ $this->assertText('Custom theme: NONE. Actual theme: garland.', 'The theme callback system falls back on the default theme when a theme that is not enabled is requested.');
+ $this->assertRaw('garland/style.css', "The default theme's CSS appears on the page.");
// Now enable the theme and request it again.
theme_enable(array('stark'));
$this->drupalGet('menu-test/theme-callback/use-stark-theme');
- $this->assertText('Custom theme: stark. Actual theme: stark.', t('The theme callback system uses an optional theme once it has been enabled.'));
- $this->assertRaw('stark/layout.css', t("The optional theme's CSS appears on the page."));
+ $this->assertText('Custom theme: stark. Actual theme: stark.', 'The theme callback system uses an optional theme once it has been enabled.');
+ $this->assertRaw('stark/layout.css', "The optional theme's CSS appears on the page.");
}
/**
@@ -145,8 +145,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testThemeCallbackFakeTheme() {
$this->drupalGet('menu-test/theme-callback/use-fake-theme');
- $this->assertText('Custom theme: NONE. Actual theme: garland.', t('The theme callback system falls back on the default theme when a theme that does not exist is requested.'));
- $this->assertRaw('garland/style.css', t("The default theme's CSS appears on the page."));
+ $this->assertText('Custom theme: NONE. Actual theme: garland.', 'The theme callback system falls back on the default theme when a theme that does not exist is requested.');
+ $this->assertRaw('garland/style.css', "The default theme's CSS appears on the page.");
}
/**
@@ -154,8 +154,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
*/
function testThemeCallbackNoThemeRequested() {
$this->drupalGet('menu-test/theme-callback/no-theme-requested');
- $this->assertText('Custom theme: NONE. Actual theme: garland.', t('The theme callback system falls back on the default theme when no theme is requested.'));
- $this->assertRaw('garland/style.css', t("The default theme's CSS appears on the page."));
+ $this->assertText('Custom theme: NONE. Actual theme: garland.', 'The theme callback system falls back on the default theme when no theme is requested.');
+ $this->assertRaw('garland/style.css', "The default theme's CSS appears on the page.");
}
/**
@@ -170,15 +170,15 @@ class MenuRouterTestCase extends DrupalWebTestCase {
// is not a currently enabled theme, our above request should be ignored,
// and Seven should still be used.
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
- $this->assertText('Custom theme: seven. Actual theme: seven.', t('The result of hook_custom_theme() does not override a theme callback when it returns a theme that is not enabled.'));
- $this->assertRaw('seven/style.css', t("The Seven theme's CSS appears on the page."));
+ $this->assertText('Custom theme: seven. Actual theme: seven.', 'The result of hook_custom_theme() does not override a theme callback when it returns a theme that is not enabled.');
+ $this->assertRaw('seven/style.css', "The Seven theme's CSS appears on the page.");
// Now enable the Stark theme and request the same page as above. This
// time, we expect hook_custom_theme() to prevail.
theme_enable(array('stark'));
$this->drupalGet('menu-test/theme-callback/use-admin-theme');
- $this->assertText('Custom theme: stark. Actual theme: stark.', t('The result of hook_custom_theme() overrides what was set in a theme callback.'));
- $this->assertRaw('stark/layout.css', t("The Stark theme's CSS appears on the page."));
+ $this->assertText('Custom theme: stark. Actual theme: stark.', 'The result of hook_custom_theme() overrides what was set in a theme callback.');
+ $this->assertRaw('stark/layout.css', "The Stark theme's CSS appears on the page.");
}
/**
@@ -212,19 +212,19 @@ class MenuRouterTestCase extends DrupalWebTestCase {
menu_link_maintain('menu_test', 'update', 'menu_test_maintain/1', 'Menu link updated');
// Load a different page to be sure that we have up to date information.
$this->drupalGet('menu_test_maintain/1');
- $this->assertLink(t('Menu link updated'), 0, t('Found updated menu link'));
- $this->assertNoLink(t('Menu link #1'), 0, t('Not found menu link #1'));
- $this->assertNoLink(t('Menu link #1'), 0, t('Not found menu link #1-1'));
- $this->assertLink(t('Menu link #2'), 0, t('Found menu link #2'));
+ $this->assertLink(t('Menu link updated'), 0, 'Found updated menu link');
+ $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1');
+ $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1-1');
+ $this->assertLink(t('Menu link #2'), 0, 'Found menu link #2');
// Delete all links for the given path.
menu_link_maintain('menu_test', 'delete', 'menu_test_maintain/1', '');
// Load a different page to be sure that we have up to date information.
$this->drupalGet('menu_test_maintain/2');
- $this->assertNoLink(t('Menu link updated'), 0, t('Not found deleted menu link'));
- $this->assertNoLink(t('Menu link #1'), 0, t('Not found menu link #1'));
- $this->assertNoLink(t('Menu link #1'), 0, t('Not found menu link #1-1'));
- $this->assertLink(t('Menu link #2'), 0, t('Found menu link #2'));
+ $this->assertNoLink(t('Menu link updated'), 0, 'Not found deleted menu link');
+ $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1');
+ $this->assertNoLink(t('Menu link #1'), 0, 'Not found menu link #1-1');
+ $this->assertLink(t('Menu link #2'), 0, 'Found menu link #2');
}
/**
@@ -248,7 +248,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$menu_names = menu_get_names();
$this->pass(implode(' | ', $menu_names));
for ($i = 0; $i < 3; $i++) {
- $this->assertTrue(in_array('menu_test_' . $i, $menu_names), t('Expected menu name %expected is returned.', array('%expected' => 'menu_test_' . $i)));
+ $this->assertTrue(in_array('menu_test_' . $i, $menu_names), 'Expected menu name ' . 'menu_test_' . $i . ' is returned.');
}
}
@@ -261,7 +261,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'";
$name = db_query($sql)->fetchField();
- $this->assertEqual($name, 'original', t('Menu name is "original".'));
+ $this->assertEqual($name, 'original', 'Menu name is "original".');
// Change the menu_name parameter in menu_test.module, then force a menu
// rebuild.
@@ -270,7 +270,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'";
$name = db_query($sql)->fetchField();
- $this->assertEqual($name, 'changed', t('Menu name was successfully changed after rebuild.'));
+ $this->assertEqual($name, 'changed', 'Menu name was successfully changed after rebuild.');
}
/**
@@ -281,8 +281,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$child_link = db_query('SELECT * FROM {menu_links} WHERE link_path = :link_path', array(':link_path' => 'menu-test/hierarchy/parent/child'))->fetchAssoc();
$unattached_child_link = db_query('SELECT * FROM {menu_links} WHERE link_path = :link_path', array(':link_path' => 'menu-test/hierarchy/parent/child2/child'))->fetchAssoc();
- $this->assertEqual($child_link['plid'], $parent_link['mlid'], t('The parent of a directly attached child is correct.'));
- $this->assertEqual($unattached_child_link['plid'], $parent_link['mlid'], t('The parent of a non-directly attached child is correct.'));
+ $this->assertEqual($child_link['plid'], $parent_link['mlid'], 'The parent of a directly attached child is correct.');
+ $this->assertEqual($unattached_child_link['plid'], $parent_link['mlid'], 'The parent of a non-directly attached child is correct.');
}
/**
@@ -302,40 +302,40 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$plid = $parent['mlid'];
$link = $links['menu-test/hidden/menu/list'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$link = $links['menu-test/hidden/menu/add'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$link = $links['menu-test/hidden/menu/settings'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$link = $links['menu-test/hidden/menu/manage/%'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$parent = $links['menu-test/hidden/menu/manage/%'];
$depth = $parent['depth'] + 1;
$plid = $parent['mlid'];
$link = $links['menu-test/hidden/menu/manage/%/list'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$link = $links['menu-test/hidden/menu/manage/%/add'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$link = $links['menu-test/hidden/menu/manage/%/edit'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$link = $links['menu-test/hidden/menu/manage/%/delete'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
// Verify links for two dynamic arguments.
$links = db_select('menu_links', 'ml')
@@ -350,28 +350,28 @@ class MenuRouterTestCase extends DrupalWebTestCase {
$plid = $parent['mlid'];
$link = $links['menu-test/hidden/block/list'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$link = $links['menu-test/hidden/block/add'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$link = $links['menu-test/hidden/block/manage/%/%'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$parent = $links['menu-test/hidden/block/manage/%/%'];
$depth = $parent['depth'] + 1;
$plid = $parent['mlid'];
$link = $links['menu-test/hidden/block/manage/%/%/configure'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
$link = $links['menu-test/hidden/block/manage/%/%/delete'];
- $this->assertEqual($link['depth'], $depth, t('%path depth @link_depth is equal to @depth.', array('%path' => $link['router_path'], '@link_depth' => $link['depth'], '@depth' => $depth)));
- $this->assertEqual($link['plid'], $plid, t('%path plid @link_plid is equal to @plid.', array('%path' => $link['router_path'], '@link_plid' => $link['plid'], '@plid' => $plid)));
+ $this->assertEqual($link['depth'], $depth, $link['router_path'] . ' depth ' . $link['depth'] . ' is equal to ' . $depth . '.');
+ $this->assertEqual($link['plid'], $plid, $link['router_path'] . ' plid ' . $link['plid'] . ' is equal to ' . $plid . '.');
}
/**
@@ -380,7 +380,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
function testMenuSetItem() {
$item = menu_get_item('node');
- $this->assertEqual($item['path'], 'node', t("Path from menu_get_item('node') is equal to 'node'"), 'menu');
+ $this->assertEqual($item['path'], 'node', "Path from menu_get_item('node') is equal to 'node'", 'menu');
// Modify the path for the item then save it.
$item['path'] = 'node_test';
@@ -388,7 +388,7 @@ class MenuRouterTestCase extends DrupalWebTestCase {
menu_set_item('node', $item);
$compare_item = menu_get_item('node');
- $this->assertEqual($compare_item, $item, t('Modified menu item is equal to newly retrieved menu item.'), 'menu');
+ $this->assertEqual($compare_item, $item, 'Modified menu item is equal to newly retrieved menu item.', 'menu');
}
/**
@@ -397,13 +397,13 @@ class MenuRouterTestCase extends DrupalWebTestCase {
function testMenuItemHooks() {
// Create an item.
menu_link_maintain('menu_test', 'insert', 'menu_test_maintain/4', 'Menu link #4');
- $this->assertEqual(menu_test_static_variable(), 'insert', t('hook_menu_link_insert() fired correctly'));
+ $this->assertEqual(menu_test_static_variable(), 'insert', 'hook_menu_link_insert() fired correctly');
// Update the item.
menu_link_maintain('menu_test', 'update', 'menu_test_maintain/4', 'Menu link updated');
- $this->assertEqual(menu_test_static_variable(), 'update', t('hook_menu_link_update() fired correctly'));
+ $this->assertEqual(menu_test_static_variable(), 'update', 'hook_menu_link_update() fired correctly');
// Delete the item.
menu_link_maintain('menu_test', 'delete', 'menu_test_maintain/4', '');
- $this->assertEqual(menu_test_static_variable(), 'delete', t('hook_menu_link_delete() fired correctly'));
+ $this->assertEqual(menu_test_static_variable(), 'delete', 'hook_menu_link_delete() fired correctly');
}
/**
@@ -428,8 +428,8 @@ class MenuRouterTestCase extends DrupalWebTestCase {
// Load front page.
$this->drupalGet('node');
- $this->assertRaw('title="Test title attribute"', t('Title attribute of a menu link renders.'));
- $this->assertRaw('testparam=testvalue', t('Query parameter added to menu link.'));
+ $this->assertRaw('title="Test title attribute"', 'Title attribute of a menu link renders.');
+ $this->assertRaw('testparam=testvalue', 'Query parameter added to menu link.');
}
}
@@ -451,14 +451,14 @@ class MenuRebuildTestCase extends DrupalWebTestCase {
function testMenuRebuildByVariable() {
// Check if 'admin' path exists.
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
- $this->assertEqual($admin_exists, 'admin', t("The path 'admin/' exists prior to deleting."));
+ $this->assertEqual($admin_exists, 'admin', "The path 'admin/' exists prior to deleting.");
// Delete the path item 'admin', and test that the path doesn't exist in the database.
$delete = db_delete('menu_router')
->condition('path', 'admin')
->execute();
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
- $this->assertFalse($admin_exists, t("The path 'admin/' has been deleted and doesn't exist in the database."));
+ $this->assertFalse($admin_exists, "The path 'admin/' has been deleted and doesn't exist in the database.");
// Now we enable the rebuild variable and trigger menu_execute_active_handler()
// to rebuild the menu item. Now 'admin' should exist.
@@ -466,7 +466,7 @@ class MenuRebuildTestCase extends DrupalWebTestCase {
// menu_execute_active_handler() should trigger the rebuild.
$this->drupalGet('<front>');
$admin_exists = db_query('SELECT path from {menu_router} WHERE path = :path', array(':path' => 'admin'))->fetchField();
- $this->assertEqual($admin_exists, 'admin', t("The menu has been rebuilt, the path 'admin' now exists again."));
+ $this->assertEqual($admin_exists, 'admin', "The menu has been rebuilt, the path 'admin' now exists again.");
}
}
@@ -501,12 +501,12 @@ class MenuTreeDataTestCase extends DrupalUnitTestCase {
$tree = menu_tree_data($this->links);
// Validate that parent items #1, #2, and #5 exist on the root level.
- $this->assertSameLink($this->links[1], $tree[1]['link'], t('Parent item #1 exists.'));
- $this->assertSameLink($this->links[2], $tree[2]['link'], t('Parent item #2 exists.'));
- $this->assertSameLink($this->links[5], $tree[5]['link'], t('Parent item #5 exists.'));
+ $this->assertSameLink($this->links[1], $tree[1]['link'], 'Parent item #1 exists.');
+ $this->assertSameLink($this->links[2], $tree[2]['link'], 'Parent item #2 exists.');
+ $this->assertSameLink($this->links[5], $tree[5]['link'], 'Parent item #5 exists.');
// Validate that child item #4 exists at the correct location in the hierarchy.
- $this->assertSameLink($this->links[4], $tree[2]['below'][3]['below'][4]['link'], t('Child item #4 exists in the hierarchy.'));
+ $this->assertSameLink($this->links[4], $tree[2]['below'][3]['below'][4]['link'], 'Child item #4 exists in the hierarchy.');
}
/**
diff --git a/modules/simpletest/tests/module.test b/modules/simpletest/tests/module.test
index 9246c1484..d3f84ee7d 100644
--- a/modules/simpletest/tests/module.test
+++ b/modules/simpletest/tests/module.test
@@ -77,9 +77,9 @@ class ModuleUnitTest extends DrupalWebTestCase {
*/
protected function assertModuleList(Array $expected_values, $condition) {
$expected_values = array_combine($expected_values, $expected_values);
- $this->assertEqual($expected_values, module_list(), t('@condition: module_list() returns correct results', array('@condition' => $condition)));
+ $this->assertEqual($expected_values, module_list(), $condition . ': module_list() returns correct results');
ksort($expected_values);
- $this->assertIdentical($expected_values, module_list(FALSE, FALSE, TRUE), t('@condition: module_list() returns correctly sorted results', array('@condition' => $condition)));
+ $this->assertIdentical($expected_values, module_list(FALSE, FALSE, TRUE), $condition . ': module_list() returns correctly sorted results');
}
/**
@@ -88,16 +88,16 @@ class ModuleUnitTest extends DrupalWebTestCase {
function testModuleImplements() {
// Clear the cache.
cache_clear_all('module_implements', 'cache_bootstrap');
- $this->assertFalse(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is empty.'));
+ $this->assertFalse(cache_get('module_implements', 'cache_bootstrap'), 'The module implements cache is empty.');
$this->drupalGet('');
- $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is populated after requesting a page.'));
+ $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), 'The module implements cache is populated after requesting a page.');
// Test again with an authenticated user.
$this->user = $this->drupalCreateUser();
$this->drupalLogin($this->user);
cache_clear_all('module_implements', 'cache_bootstrap');
$this->drupalGet('');
- $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), t('The module implements cache is populated after requesting a page.'));
+ $this->assertTrue(cache_get('module_implements', 'cache_bootstrap'), 'The module implements cache is populated after requesting a page.');
// Make sure group include files are detected properly even when the file is
// already loaded when the cache is rebuilt.
@@ -116,23 +116,23 @@ class ModuleUnitTest extends DrupalWebTestCase {
*/
function testDependencyResolution() {
module_enable(array('module_test'), FALSE);
- $this->assertTrue(module_exists('module_test'), t('Test module is enabled.'));
+ $this->assertTrue(module_exists('module_test'), 'Test module is enabled.');
// First, create a fake missing dependency. Forum depends on poll, which
// depends on a made-up module, foo. Nothing should be installed.
variable_set('dependency_test', 'missing dependency');
$result = module_enable(array('forum'));
- $this->assertFalse($result, t('module_enable() returns FALSE if dependencies are missing.'));
- $this->assertFalse(module_exists('forum'), t('module_enable() aborts if dependencies are missing.'));
+ $this->assertFalse($result, 'module_enable() returns FALSE if dependencies are missing.');
+ $this->assertFalse(module_exists('forum'), 'module_enable() aborts if dependencies are missing.');
// Now, fix the missing dependency. module_enable() should work.
variable_set('dependency_test', 'dependency');
$result = module_enable(array('forum'));
- $this->assertTrue($result, t('module_enable() returns the correct value.'));
+ $this->assertTrue($result, 'module_enable() returns the correct value.');
// Verify that the fake dependency chain was installed.
- $this->assertTrue(module_exists('poll') && module_exists('php'), t('Dependency chain was installed by module_enable().'));
+ $this->assertTrue(module_exists('poll') && module_exists('php'), 'Dependency chain was installed by module_enable().');
// Finally, verify that the original module was installed.
- $this->assertTrue(module_exists('forum'), t('Module installation with unlisted dependencies succeeded.'));
+ $this->assertTrue(module_exists('forum'), 'Module installation with unlisted dependencies succeeded.');
}
}
@@ -168,8 +168,8 @@ class ModuleInstallTestCase extends DrupalWebTestCase {
// Check for data that was inserted using drupal_write_record() while the
// 'module_test' module was being installed and enabled.
$data = db_query("SELECT data FROM {module_test}")->fetchCol();
- $this->assertTrue(in_array('Data inserted in hook_install()', $data), t('Data inserted using drupal_write_record() in hook_install() is correctly saved.'));
- $this->assertTrue(in_array('Data inserted in hook_enable()', $data), t('Data inserted using drupal_write_record() in hook_enable() is correctly saved.'));
+ $this->assertTrue(in_array('Data inserted in hook_install()', $data), 'Data inserted using drupal_write_record() in hook_install() is correctly saved.');
+ $this->assertTrue(in_array('Data inserted in hook_enable()', $data), 'Data inserted using drupal_write_record() in hook_enable() is correctly saved.');
}
}
@@ -200,6 +200,6 @@ class ModuleUninstallTestCase extends DrupalWebTestCase {
// Are the perms defined by module_test removed from {role_permission}.
$count = db_query("SELECT COUNT(rid) FROM {role_permission} WHERE permission = :perm", array(':perm' => 'module_test perm'))->fetchField();
- $this->assertEqual(0, $count, t('Permissions were all removed.'));
+ $this->assertEqual(0, $count, 'Permissions were all removed.');
}
}
diff --git a/modules/simpletest/tests/path.test b/modules/simpletest/tests/path.test
index f99585691..ea3c0a1d7 100644
--- a/modules/simpletest/tests/path.test
+++ b/modules/simpletest/tests/path.test
@@ -42,7 +42,7 @@ class DrupalMatchPathTestCase extends DrupalWebTestCase {
foreach ($tests as $patterns => $cases) {
foreach ($cases as $path => $expected_result) {
$actual_result = drupal_match_path($path, $patterns);
- $this->assertIdentical($actual_result, $expected_result, t('Tried matching the path <code>@path</code> to the pattern <pre>@patterns</pre> - expected @expected, got @actual.', array('@path' => $path, '@patterns' => $patterns, '@expected' => var_export($expected_result, TRUE), '@actual' => var_export($actual_result, TRUE))));
+ $this->assertIdentical($actual_result, $expected_result, 'Tried matching the path <code>' . $path . '</code> to the pattern <pre>' . $patterns . '</pre> - expected ' . var_export($expected_result, TRUE) . ', got ' . var_export($actual_result, TRUE) . '.');
}
}
}
@@ -197,8 +197,8 @@ class UrlAlterFunctionalTest extends DrupalWebTestCase {
*/
function testCurrentUrlRequestedPath() {
$this->drupalGet('url-alter-test/bar');
- $this->assertRaw('request_path=url-alter-test/bar', t('request_path() returns the requested path.'));
- $this->assertRaw('current_path=url-alter-test/foo', t('current_path() returns the internal path.'));
+ $this->assertRaw('request_path=url-alter-test/bar', 'request_path() returns the requested path.');
+ $this->assertRaw('current_path=url-alter-test/foo', 'current_path() returns the internal path.');
}
/**
@@ -216,7 +216,7 @@ class UrlAlterFunctionalTest extends DrupalWebTestCase {
$result = url($original);
$base_path = base_path() . (variable_get('clean_url', '0') ? '' : '?q=');
$result = substr($result, strlen($base_path));
- $this->assertIdentical($result, $final, t('Altered outbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result)));
+ $this->assertIdentical($result, $final, 'Altered outbound URL ' . $original . ', expected ' . $final . ', and got ' . $result . '.');
}
/**
@@ -233,6 +233,6 @@ class UrlAlterFunctionalTest extends DrupalWebTestCase {
protected function assertUrlInboundAlter($original, $final) {
// Test inbound altering.
$result = drupal_get_normal_path($original);
- $this->assertIdentical($result, $final, t('Altered inbound URL %original, expected %final, and got %result.', array('%original' => $original, '%final' => $final, '%result' => $result)));
+ $this->assertIdentical($result, $final, 'Altered inbound URL ' . $original . ', expected ' . $final . ', and got ' . $result . '.');
}
}
diff --git a/modules/simpletest/tests/registry.test b/modules/simpletest/tests/registry.test
index 10b04578d..0afe5e3aa 100644
--- a/modules/simpletest/tests/registry.test
+++ b/modules/simpletest/tests/registry.test
@@ -25,7 +25,7 @@ class RegistryParseFileTestCase extends DrupalWebTestCase {
_registry_parse_file($this->fileName, $this->getFileContents());
foreach (array('className', 'interfaceName') as $resource) {
$foundName = db_query('SELECT name FROM {registry} WHERE name = :name', array(':name' => $this->$resource))->fetchField();
- $this->assertTrue($this->$resource == $foundName, t('Resource "@resource" found.', array('@resource' => $this->$resource)));
+ $this->assertTrue($this->$resource == $foundName, 'Resource "' . $this->$resource . '" found.');
}
}
@@ -103,11 +103,11 @@ class RegistryParseFilesTestCase extends DrupalWebTestCase {
// Test that we have all the right resources.
foreach (array('className', 'interfaceName') as $resource) {
$foundName = db_query('SELECT name FROM {registry} WHERE name = :name', array(':name' => $this->$fileType->$resource))->fetchField();
- $this->assertTrue($this->$fileType->$resource == $foundName, t('Resource "@resource" found.', array('@resource' => $this->$fileType->$resource)));
+ $this->assertTrue($this->$fileType->$resource == $foundName, 'Resource "' . $this->$fileType->$resource . '" found.');
}
// Test that we have the right hash.
$hash = db_query('SELECT hash FROM {registry_file} WHERE filename = :filename', array(':filename' => $this->$fileType->fileName))->fetchField();
- $this->assertTrue(hash('sha256', $this->$fileType->contents) == $hash, t('sha-256 for "@filename" matched.' . $fileType . $hash, array('@filename' => $this->$fileType->fileName)));
+ $this->assertTrue(hash('sha256', $this->$fileType->contents) == $hash, 'sha-256 for "' . $this->$fileType->fileName . '" matched.' . $fileType . $hash);
}
}
diff --git a/modules/simpletest/tests/schema.test b/modules/simpletest/tests/schema.test
index 53e8ea723..65cdf2ce5 100644
--- a/modules/simpletest/tests/schema.test
+++ b/modules/simpletest/tests/schema.test
@@ -40,7 +40,7 @@ class SchemaTestCase extends DrupalWebTestCase {
db_create_table('test_table', $table_specification);
// Assert that the table exists.
- $this->assertTrue(db_table_exists('test_table'), t('The table exists.'));
+ $this->assertTrue(db_table_exists('test_table'), 'The table exists.');
// Assert that the table comment has been set.
$this->checkSchemaComment($table_specification['description'], 'test_table');
@@ -49,46 +49,46 @@ class SchemaTestCase extends DrupalWebTestCase {
$this->checkSchemaComment($table_specification['fields']['test_field']['description'], 'test_table', 'test_field');
// An insert without a value for the column 'test_table' should fail.
- $this->assertFalse($this->tryInsert(), t('Insert without a default failed.'));
+ $this->assertFalse($this->tryInsert(), 'Insert without a default failed.');
// Add a default value to the column.
db_field_set_default('test_table', 'test_field', 0);
// The insert should now succeed.
- $this->assertTrue($this->tryInsert(), t('Insert with a default succeeded.'));
+ $this->assertTrue($this->tryInsert(), 'Insert with a default succeeded.');
// Remove the default.
db_field_set_no_default('test_table', 'test_field');
// The insert should fail again.
- $this->assertFalse($this->tryInsert(), t('Insert without a default failed.'));
+ $this->assertFalse($this->tryInsert(), 'Insert without a default failed.');
// Test for fake index and test for the boolean result of indexExists().
$index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field');
- $this->assertIdentical($index_exists, FALSE, t('Fake index does not exists'));
+ $this->assertIdentical($index_exists, FALSE, 'Fake index does not exists');
// Add index.
db_add_index('test_table', 'test_field', array('test_field'));
// Test for created index and test for the boolean result of indexExists().
$index_exists = Database::getConnection()->schema()->indexExists('test_table', 'test_field');
- $this->assertIdentical($index_exists, TRUE, t('Index created.'));
+ $this->assertIdentical($index_exists, TRUE, 'Index created.');
// Rename the table.
db_rename_table('test_table', 'test_table2');
// Index should be renamed.
$index_exists = Database::getConnection()->schema()->indexExists('test_table2', 'test_field');
- $this->assertTrue($index_exists, t('Index was renamed.'));
+ $this->assertTrue($index_exists, 'Index was renamed.');
// We need the default so that we can insert after the rename.
db_field_set_default('test_table2', 'test_field', 0);
- $this->assertFalse($this->tryInsert(), t('Insert into the old table failed.'));
- $this->assertTrue($this->tryInsert('test_table2'), t('Insert into the new table succeeded.'));
+ $this->assertFalse($this->tryInsert(), 'Insert into the old table failed.');
+ $this->assertTrue($this->tryInsert('test_table2'), 'Insert into the new table succeeded.');
// We should have successfully inserted exactly two rows.
$count = db_query('SELECT COUNT(*) FROM {test_table2}')->fetchField();
- $this->assertEqual($count, 2, t('Two fields were successfully inserted.'));
+ $this->assertEqual($count, 2, 'Two fields were successfully inserted.');
// Try to drop the table.
db_drop_table('test_table2');
- $this->assertFalse(db_table_exists('test_table2'), t('The dropped table does not exist.'));
+ $this->assertFalse(db_table_exists('test_table2'), 'The dropped table does not exist.');
// Recreate the table.
db_create_table('test_table', $table_specification);
@@ -104,19 +104,19 @@ class SchemaTestCase extends DrupalWebTestCase {
// Assert that the column comment has been set.
$this->checkSchemaComment('Changed column description.', 'test_table', 'test_serial');
- $this->assertTrue($this->tryInsert(), t('Insert with a serial succeeded.'));
+ $this->assertTrue($this->tryInsert(), 'Insert with a serial succeeded.');
$max1 = db_query('SELECT MAX(test_serial) FROM {test_table}')->fetchField();
- $this->assertTrue($this->tryInsert(), t('Insert with a serial succeeded.'));
+ $this->assertTrue($this->tryInsert(), 'Insert with a serial succeeded.');
$max2 = db_query('SELECT MAX(test_serial) FROM {test_table}')->fetchField();
- $this->assertTrue($max2 > $max1, t('The serial is monotone.'));
+ $this->assertTrue($max2 > $max1, 'The serial is monotone.');
$count = db_query('SELECT COUNT(*) FROM {test_table}')->fetchField();
- $this->assertEqual($count, 2, t('There were two rows.'));
+ $this->assertEqual($count, 2, 'There were two rows.');
}
function tryInsert($table = 'test_table') {
try {
- db_insert($table)
+ db_insert($table)
->fields(array('id' => mt_rand(10, 20)))
->execute();
return TRUE;
@@ -139,7 +139,7 @@ class SchemaTestCase extends DrupalWebTestCase {
function checkSchemaComment($description, $table, $column = NULL) {
if (method_exists(Database::getConnection()->schema(), 'getComment')) {
$comment = Database::getConnection()->schema()->getComment($table, $column);
- $this->assertEqual($comment, $description, t('The comment matches the schema description.'));
+ $this->assertEqual($comment, $description, 'The comment matches the schema description.');
}
}
@@ -159,7 +159,7 @@ class SchemaTestCase extends DrupalWebTestCase {
// Now set up columns for the other types.
$types = array('int', 'float', 'numeric');
foreach ($types as $type) {
- $column_spec = array('type' => $type, 'unsigned'=> TRUE);
+ $column_spec = array('type' => $type, 'unsigned' => TRUE);
if ($type == 'numeric') {
$column_spec += array('precision' => 10, 'scale' => 0);
}
@@ -169,9 +169,9 @@ class SchemaTestCase extends DrupalWebTestCase {
}
// Finally, check each column and try to insert invalid values into them.
- foreach($table_spec['fields'] as $column_name => $column_spec) {
- $this->assertTrue(db_field_exists($table_name, $column_name), t('Unsigned @type column was created.', array('@type' => $column_spec['type'])));
- $this->assertFalse($this->tryUnsignedInsert($table_name, $column_name), t('Unsigned @type column rejected a negative value.', array('@type' => $column_spec['type'])));
+ foreach ($table_spec['fields'] as $column_name => $column_spec) {
+ $this->assertTrue(db_field_exists($table_name, $column_name), 'Unsigned ' . $column_spec['type'] . ' column was created.');
+ $this->assertFalse($this->tryUnsignedInsert($table_name, $column_name), 'Unsigned ' . $column_spec['type'] . ' column rejected a negative value.');
}
}
diff --git a/modules/simpletest/tests/session.test b/modules/simpletest/tests/session.test
index 600843bb8..9b899a15d 100644
--- a/modules/simpletest/tests/session.test
+++ b/modules/simpletest/tests/session.test
@@ -23,11 +23,11 @@ class SessionTestCase extends DrupalWebTestCase {
* Tests for drupal_save_session() and drupal_session_regenerate().
*/
function testSessionSaveRegenerate() {
- $this->assertFalse(drupal_save_session(), t('drupal_save_session() correctly returns FALSE (inside of testing framework) when initially called with no arguments.'), t('Session'));
- $this->assertFalse(drupal_save_session(FALSE), t('drupal_save_session() correctly returns FALSE when called with FALSE.'), t('Session'));
- $this->assertFalse(drupal_save_session(), t('drupal_save_session() correctly returns FALSE when saving has been disabled.'), t('Session'));
- $this->assertTrue(drupal_save_session(TRUE), t('drupal_save_session() correctly returns TRUE when called with TRUE.'), t('Session'));
- $this->assertTrue(drupal_save_session(), t('drupal_save_session() correctly returns TRUE when saving has been enabled.'), t('Session'));
+ $this->assertFalse(drupal_save_session(), 'drupal_save_session() correctly returns FALSE (inside of testing framework) when initially called with no arguments.', 'Session');
+ $this->assertFalse(drupal_save_session(FALSE), 'drupal_save_session() correctly returns FALSE when called with FALSE.', 'Session');
+ $this->assertFalse(drupal_save_session(), 'drupal_save_session() correctly returns FALSE when saving has been disabled.', 'Session');
+ $this->assertTrue(drupal_save_session(TRUE), 'drupal_save_session() correctly returns TRUE when called with TRUE.', 'Session');
+ $this->assertTrue(drupal_save_session(), 'drupal_save_session() correctly returns TRUE when saving has been enabled.', 'Session');
// Test session hardening code from SA-2008-044.
$user = $this->drupalCreateUser(array('access content'));
@@ -37,7 +37,7 @@ class SessionTestCase extends DrupalWebTestCase {
// Make sure the session cookie is set as HttpOnly.
$this->drupalLogin($user);
- $this->assertTrue(preg_match('/HttpOnly/i', $this->drupalGetHeader('Set-Cookie', TRUE)), t('Session cookie is set as HttpOnly.'));
+ $this->assertTrue(preg_match('/HttpOnly/i', $this->drupalGetHeader('Set-Cookie', TRUE)), 'Session cookie is set as HttpOnly.');
$this->drupalLogout();
// Verify that the session is regenerated if a module calls exit
@@ -47,7 +47,7 @@ class SessionTestCase extends DrupalWebTestCase {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->drupalGetContent(), $matches);
- $this->assertTrue(!empty($matches[1]) , t('Found session ID before logging in.'));
+ $this->assertTrue(!empty($matches[1]), 'Found session ID before logging in.');
$original_session = $matches[1];
// We cannot use $this->drupalLogin($user); because we exit in
@@ -58,14 +58,14 @@ class SessionTestCase extends DrupalWebTestCase {
);
$this->drupalPost('user', $edit, t('Log in'));
$this->drupalGet('user');
- $pass = $this->assertText($user->name, t('Found name: %name', array('%name' => $user->name)), t('User login'));
+ $pass = $this->assertText($user->name, 'Found name: ' . $user->name, 'User login');
$this->_logged_in = $pass;
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->drupalGetContent(), $matches);
- $this->assertTrue(!empty($matches[1]) , t('Found session ID after logging in.'));
- $this->assertTrue($matches[1] != $original_session, t('Session ID changed after login.'));
+ $this->assertTrue(!empty($matches[1]), 'Found session ID after logging in.');
+ $this->assertTrue($matches[1] != $original_session, 'Session ID changed after login.');
}
/**
@@ -81,48 +81,48 @@ class SessionTestCase extends DrupalWebTestCase {
$value_1 = $this->randomName();
$this->drupalGet('session-test/set/' . $value_1);
- $this->assertText($value_1, t('The session value was stored.'), t('Session'));
+ $this->assertText($value_1, 'The session value was stored.', 'Session');
$this->drupalGet('session-test/get');
- $this->assertText($value_1, t('Session correctly returned the stored data for an authenticated user.'), t('Session'));
+ $this->assertText($value_1, 'Session correctly returned the stored data for an authenticated user.', 'Session');
// Attempt to write over val_1. If drupal_save_session(FALSE) is working.
// properly, val_1 will still be set.
$value_2 = $this->randomName();
$this->drupalGet('session-test/no-set/' . $value_2);
- $this->assertText($value_2, t('The session value was correctly passed to session-test/no-set.'), t('Session'));
+ $this->assertText($value_2, 'The session value was correctly passed to session-test/no-set.', 'Session');
$this->drupalGet('session-test/get');
- $this->assertText($value_1, t('Session data is not saved for drupal_save_session(FALSE).'), t('Session'));
+ $this->assertText($value_1, 'Session data is not saved for drupal_save_session(FALSE).', 'Session');
// Switch browser cookie to anonymous user, then back to user 1.
$this->sessionReset();
$this->sessionReset($user->uid);
- $this->assertText($value_1, t('Session data persists through browser close.'), t('Session'));
+ $this->assertText($value_1, 'Session data persists through browser close.', 'Session');
// Logout the user and make sure the stored value no longer persists.
$this->drupalLogout();
$this->sessionReset();
$this->drupalGet('session-test/get');
- $this->assertNoText($value_1, t("After logout, previous user's session data is not available."), t('Session'));
+ $this->assertNoText($value_1, "After logout, previous user's session data is not available.", 'Session');
// Now try to store some data as an anonymous user.
$value_3 = $this->randomName();
$this->drupalGet('session-test/set/' . $value_3);
- $this->assertText($value_3, t('Session data stored for anonymous user.'), t('Session'));
+ $this->assertText($value_3, 'Session data stored for anonymous user.', 'Session');
$this->drupalGet('session-test/get');
- $this->assertText($value_3, t('Session correctly returned the stored data for an anonymous user.'), t('Session'));
+ $this->assertText($value_3, 'Session correctly returned the stored data for an anonymous user.', 'Session');
// Try to store data when drupal_save_session(FALSE).
$value_4 = $this->randomName();
$this->drupalGet('session-test/no-set/' . $value_4);
- $this->assertText($value_4, t('The session value was correctly passed to session-test/no-set.'), t('Session'));
+ $this->assertText($value_4, 'The session value was correctly passed to session-test/no-set.', 'Session');
$this->drupalGet('session-test/get');
- $this->assertText($value_3, t('Session data is not saved for drupal_save_session(FALSE).'), t('Session'));
+ $this->assertText($value_3, 'Session data is not saved for drupal_save_session(FALSE).', 'Session');
// Login, the data should persist.
$this->drupalLogin($user);
$this->sessionReset($user->uid);
$this->drupalGet('session-test/get');
- $this->assertNoText($value_1, t('Session has persisted for an authenticated user after logging out and then back in.'), t('Session'));
+ $this->assertNoText($value_1, 'Session has persisted for an authenticated user after logging out and then back in.', 'Session');
// Change session and create another user.
$user2 = $this->drupalCreateUser(array('access content'));
@@ -144,29 +144,29 @@ class SessionTestCase extends DrupalWebTestCase {
$this->drupalGet('');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(TRUE);
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', t('Page was not cached.'));
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'MISS', 'Page was not cached.');
// Start a new session by setting a message.
$this->drupalGet('session-test/set-message');
$this->assertSessionCookie(TRUE);
- $this->assertTrue($this->drupalGetHeader('Set-Cookie'), t('New session was started.'));
+ $this->assertTrue($this->drupalGetHeader('Set-Cookie'), 'New session was started.');
// Display the message, during the same request the session is destroyed
// and the session cookie is unset.
$this->drupalGet('');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(FALSE);
- $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), t('Caching was bypassed.'));
- $this->assertText(t('This is a dummy message.'), t('Message was displayed.'));
- $this->assertTrue(preg_match('/SESS\w+=deleted/', $this->drupalGetHeader('Set-Cookie')), t('Session cookie was deleted.'));
+ $this->assertFalse($this->drupalGetHeader('X-Drupal-Cache'), 'Caching was bypassed.');
+ $this->assertText(t('This is a dummy message.'), 'Message was displayed.');
+ $this->assertTrue(preg_match('/SESS\w+=deleted/', $this->drupalGetHeader('Set-Cookie')), 'Session cookie was deleted.');
// Verify that session was destroyed.
$this->drupalGet('');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(TRUE);
- $this->assertNoText(t('This is a dummy message.'), t('Message was not cached.'));
- $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', t('Page was cached.'));
- $this->assertFalse($this->drupalGetHeader('Set-Cookie'), t('New session was not started.'));
+ $this->assertNoText(t('This is a dummy message.'), 'Message was not cached.');
+ $this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
+ $this->assertFalse($this->drupalGetHeader('Set-Cookie'), 'New session was not started.');
// Verify that no session is created if drupal_save_session(FALSE) is called.
$this->drupalGet('session-test/set-message-but-dont-save');
@@ -177,7 +177,7 @@ class SessionTestCase extends DrupalWebTestCase {
$this->drupalGet('');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(TRUE);
- $this->assertNoText(t('This is a dummy message.'), t('The message was not saved.'));
+ $this->assertNoText(t('This is a dummy message.'), 'The message was not saved.');
}
/**
@@ -195,7 +195,7 @@ class SessionTestCase extends DrupalWebTestCase {
$this->additionalCurlOptions[CURLOPT_COOKIEFILE] = $this->cookieFile;
$this->additionalCurlOptions[CURLOPT_COOKIESESSION] = TRUE;
$this->drupalGet('session-test/get');
- $this->assertResponse(200, t('Session test module is correctly enabled.'), t('Session'));
+ $this->assertResponse(200, 'Session test module is correctly enabled.', 'Session');
}
/**
@@ -203,10 +203,10 @@ class SessionTestCase extends DrupalWebTestCase {
*/
function assertSessionCookie($sent) {
if ($sent) {
- $this->assertNotNull($this->session_id, t('Session cookie was sent.'));
+ $this->assertNotNull($this->session_id, 'Session cookie was sent.');
}
else {
- $this->assertNull($this->session_id, t('Session cookie was not sent.'));
+ $this->assertNull($this->session_id, 'Session cookie was not sent.');
}
}
@@ -215,10 +215,10 @@ class SessionTestCase extends DrupalWebTestCase {
*/
function assertSessionEmpty($empty) {
if ($empty) {
- $this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '1', t('Session was empty.'));
+ $this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '1', 'Session was empty.');
}
else {
- $this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '0', t('Session was not empty.'));
+ $this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '0', 'Session was not empty.');
}
}
}
@@ -366,7 +366,7 @@ class SessionHttpsTestCase extends DrupalWebTestCase {
}
}
- // Test that session data saved before login is not available using the
+ // Test that session data saved before login is not available using the
// pre-login anonymous cookie.
$this->cookies = array();
$this->drupalGet('session-test/get', array('Cookie: ' . $anonymous_cookie));
diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test
index 1f6373723..c44495d75 100644
--- a/modules/simpletest/tests/theme.test
+++ b/modules/simpletest/tests/theme.test
@@ -32,25 +32,25 @@ class ThemeUnitTest extends DrupalWebTestCase {
variable_set('site_frontpage', 'nobody-home');
$args = array('node', '1', 'edit');
$suggestions = theme_get_suggestions($args, 'page');
- $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1', 'page__node__edit'), t('Found expected node edit page suggestions'));
+ $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1', 'page__node__edit'), 'Found expected node edit page suggestions');
// Check attack vectors.
$args = array('node', '\\1');
$suggestions = theme_get_suggestions($args, 'page');
- $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), t('Removed invalid \\ from suggestions'));
+ $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), 'Removed invalid \\ from suggestions');
$args = array('node', '1/');
$suggestions = theme_get_suggestions($args, 'page');
- $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), t('Removed invalid / from suggestions'));
+ $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), 'Removed invalid / from suggestions');
$args = array('node', "1\0");
$suggestions = theme_get_suggestions($args, 'page');
- $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), t('Removed invalid \\0 from suggestions'));
+ $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), 'Removed invalid \\0 from suggestions');
}
/**
- * Preprocess functions for the base hook should run even for suggestion implementations.
- */
+ * Preprocess functions for the base hook should run even for suggestion implementations.
+ */
function testPreprocessForSuggestions() {
$this->drupalGet('theme-test/suggestion');
- $this->assertText('test_theme_breadcrumb__suggestion: 1', t('Theme hook suggestion ran with data available from a preprocess function for the base hook.'));
+ $this->assertText('test_theme_breadcrumb__suggestion: 1', 'Theme hook suggestion ran with data available from a preprocess function for the base hook.');
}
/**
@@ -64,7 +64,7 @@ class ThemeUnitTest extends DrupalWebTestCase {
$suggestions = theme_get_suggestions(explode('/', $_GET['q']), 'page');
// Set it back to not annoy the batch runner.
$_GET['q'] = $q;
- $this->assertTrue(in_array('page__front', $suggestions), t('Front page template was suggested.'));
+ $this->assertTrue(in_array('page__front', $suggestions), 'Front page template was suggested.');
}
}
@@ -85,11 +85,11 @@ class ThemeTableUnitTest extends DrupalWebTestCase {
*/
function testThemeTableStickyHeaders() {
$header = array('one', 'two', 'three');
- $rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
+ $rows = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
$this->content = theme('table', array('header' => $header, 'rows' => $rows));
$js = drupal_add_js();
- $this->assertTrue(isset($js['misc/tableheader.js']), t('tableheader.js was included when $sticky = TRUE.'));
- $this->assertRaw('sticky-enabled', t('Table has a class of sticky-enabled when $sticky = TRUE.'));
+ $this->assertTrue(isset($js['misc/tableheader.js']), 'tableheader.js was included when $sticky = TRUE.');
+ $this->assertRaw('sticky-enabled', 'Table has a class of sticky-enabled when $sticky = TRUE.');
drupal_static_reset('drupal_add_js');
}
@@ -98,14 +98,14 @@ class ThemeTableUnitTest extends DrupalWebTestCase {
*/
function testThemeTableNoStickyHeaders() {
$header = array('one', 'two', 'three');
- $rows = array(array(1,2,3), array(4,5,6), array(7,8,9));
+ $rows = array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9));
$attributes = array();
$caption = NULL;
$colgroups = array();
$this->content = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes, 'caption' => $caption, 'colgroups' => $colgroups, 'sticky' => FALSE));
$js = drupal_add_js();
- $this->assertFalse(isset($js['misc/tableheader.js']), t('tableheader.js was not included because $sticky = FALSE.'));
- $this->assertNoRaw('sticky-enabled', t('Table does not have a class of sticky-enabled because $sticky = FALSE.'));
+ $this->assertFalse(isset($js['misc/tableheader.js']), 'tableheader.js was not included because $sticky = FALSE.');
+ $this->assertNoRaw('sticky-enabled', 'Table does not have a class of sticky-enabled because $sticky = FALSE.');
drupal_static_reset('drupal_add_js');
}
@@ -122,8 +122,8 @@ class ThemeTableUnitTest extends DrupalWebTestCase {
),
);
$this->content = theme('table', array('header' => $header, 'rows' => array(), 'empty' => t('No strings available.')));
- $this->assertRaw('<tr class="odd"><td colspan="3" class="empty message">No strings available.</td>', t('Correct colspan was set on empty message.'));
- $this->assertRaw('<thead><tr><th>Header 1</th>', t('Table header was printed.'));
+ $this->assertRaw('<tr class="odd"><td colspan="3" class="empty message">No strings available.</td>', 'Correct colspan was set on empty message.');
+ $this->assertRaw('<thead><tr><th>Header 1</th>', 'Table header was printed.');
}
}
@@ -178,7 +178,7 @@ class ThemeHookInitUnitTest extends DrupalWebTestCase {
*/
function testThemeInitializationHookInit() {
$this->drupalGet('theme-test/hook-init');
- $this->assertRaw('Themed output generated in hook_init()', t('Themed output generated in hook_init() correctly appears on the page.'));
- $this->assertRaw('garland/style.css', t("The default theme's CSS appears on the page when the theme system is initialized in hook_init()."));
+ $this->assertRaw('Themed output generated in hook_init()', 'Themed output generated in hook_init() correctly appears on the page.');
+ $this->assertRaw('garland/style.css', "The default theme's CSS appears on the page when the theme system is initialized in hook_init().");
}
}
diff --git a/modules/simpletest/tests/unicode.test b/modules/simpletest/tests/unicode.test
index cdae50955..e4fa1457b 100644
--- a/modules/simpletest/tests/unicode.test
+++ b/modules/simpletest/tests/unicode.test
@@ -35,13 +35,13 @@ class UnicodeUnitTest extends DrupalWebTestCase {
// mbstring was not detected on this installation, there is no way to test
// multibyte features. Treat that as an exception.
if ($multibyte == UNICODE_SINGLEBYTE) {
- $this->error(t('Unable to test Multibyte features: mbstring extension was not detected.'));
+ $this->error('Unable to test Multibyte features: mbstring extension was not detected.');
}
$multibyte = UNICODE_MULTIBYTE;
$this->extendedMode = TRUE;
- $this->pass(t('Testing in mbstring mode'));
+ $this->pass('Testing in mbstring mode');
$this->helperTestStrToLower();
$this->helperTestStrToUpper();
@@ -61,7 +61,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
$this->extendedMode = FALSE;
- $this->pass(t('Testing in emulated (best-effort) mode'));
+ $this->pass('Testing in emulated (best-effort) mode');
$this->helperTestStrToLower();
$this->helperTestStrToUpper();
@@ -81,7 +81,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
}
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, $input . ' is lowercased as ' . $output);
}
}
@@ -95,7 +95,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
}
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, $input . ' is uppercased as ' . $output);
}
}
@@ -111,7 +111,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
}
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, $input . ' is ucfirst-ed as ' . $output);
}
}
@@ -122,7 +122,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
);
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, $input . ' length is ' . $output);
}
}
@@ -182,7 +182,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
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, $input . ' substring at offset ' . $start . ' for ' . $length . ' characters is ' . $output . ' (got ' . $result . ')');
}
}
@@ -214,7 +214,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
'&euro;' => '€',
);
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, 'Make sure the decoded entity of ' . $input . ' is ' . $output);
}
}
@@ -244,7 +244,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
);
$exclude = array('<', '&', '"');
foreach ($testcase as $input => $output) {
- $this->assertIdentical(decode_entities($input, $exclude), $output, t('Make sure the decoded entity of %input, excluding %excludes, is %output', array('%input' => $input, '%excludes' => implode(',', $exclude), '%output' => $output)));
+ $this->assertIdentical(decode_entities($input, $exclude), $output, 'Make sure the decoded entity of ' . $input . ', excluding ' . implode(',', $exclude) . ', is ' . $output);
}
}
@@ -330,7 +330,7 @@ class UnicodeUnitTest extends DrupalWebTestCase {
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, $input . ' truncate to ' . $max_length . ' characters with ' . ($wordsafe ? 'word-safe' : 'not word-safe') . ', ' . ($ellipsis ? 'ellipsis' : 'not ellipsis') . ' is ' . $expected . ' (got ' . $output . ')');
}
}
}
diff --git a/modules/simpletest/tests/update.test b/modules/simpletest/tests/update.test
index c4d382847..61e338c10 100644
--- a/modules/simpletest/tests/update.test
+++ b/modules/simpletest/tests/update.test
@@ -36,7 +36,7 @@ class UpdateDependencyOrderingTestCase extends DrupalWebTestCase {
'update_test_1_update_7002',
);
$actual_updates = array_keys(update_resolve_dependencies($starting_updates));
- $this->assertEqual($expected_updates, $actual_updates, t('Updates within a single module run in the correct order.'));
+ $this->assertEqual($expected_updates, $actual_updates, 'Updates within a single module run in the correct order.');
}
/**
@@ -50,9 +50,9 @@ class UpdateDependencyOrderingTestCase extends DrupalWebTestCase {
$update_order = array_keys(update_resolve_dependencies($starting_updates));
// Make sure that each dependency is satisfied.
$first_dependency_satisfied = array_search('update_test_2_update_7000', $update_order) < array_search('update_test_3_update_7000', $update_order);
- $this->assertTrue($first_dependency_satisfied, t('The dependency of the second module on the first module is respected by the update function order.'));
+ $this->assertTrue($first_dependency_satisfied, 'The dependency of the second module on the first module is respected by the update function order.');
$second_dependency_satisfied = array_search('update_test_3_update_7000', $update_order) < array_search('update_test_2_update_7001', $update_order);
- $this->assertTrue($second_dependency_satisfied, t('The dependency of the first module on the second module is respected by the update function order.'));
+ $this->assertTrue($second_dependency_satisfied, 'The dependency of the first module on the second module is respected by the update function order.');
}
}
@@ -80,9 +80,9 @@ class UpdateDependencyMissingTestCase extends DrupalWebTestCase {
'update_test_2' => 7000,
);
$update_graph = update_resolve_dependencies($starting_updates);
- $this->assertTrue($update_graph['update_test_2_update_7000']['allowed'], t("The module's first update function is allowed to run, since it does not have any missing dependencies."));
- $this->assertFalse($update_graph['update_test_2_update_7001']['allowed'], t("The module's second update function is not allowed to run, since it has a direct dependency on a missing update."));
- $this->assertFalse($update_graph['update_test_2_update_7002']['allowed'], t("The module's third update function is not allowed to run, since it has an indirect dependency on a missing update."));
+ $this->assertTrue($update_graph['update_test_2_update_7000']['allowed'], "The module's first update function is allowed to run, since it does not have any missing dependencies.");
+ $this->assertFalse($update_graph['update_test_2_update_7001']['allowed'], "The module's second update function is not allowed to run, since it has a direct dependency on a missing update.");
+ $this->assertFalse($update_graph['update_test_2_update_7002']['allowed'], "The module's third update function is not allowed to run, since it has an indirect dependency on a missing update.");
}
}
@@ -108,9 +108,9 @@ class UpdateDependencyHookInvocationTestCase extends DrupalWebTestCase {
*/
function testHookUpdateDependencies() {
$update_dependencies = update_retrieve_dependencies();
- $this->assertTrue($update_dependencies['system'][7000]['update_test_1'] == 7000, t('An update function that has a dependency on two separate modules has the first dependency recorded correctly.'));
- $this->assertTrue($update_dependencies['system'][7000]['update_test_2'] == 7001, t('An update function that has a dependency on two separate modules has the second dependency recorded correctly.'));
- $this->assertTrue($update_dependencies['system'][7001]['update_test_1'] == 7002, t('An update function that depends on more than one update from the same module only has the dependency on the higher-numbered update function recorded.'));
+ $this->assertTrue($update_dependencies['system'][7000]['update_test_1'] == 7000, 'An update function that has a dependency on two separate modules has the first dependency recorded correctly.');
+ $this->assertTrue($update_dependencies['system'][7000]['update_test_2'] == 7001, 'An update function that has a dependency on two separate modules has the second dependency recorded correctly.');
+ $this->assertTrue($update_dependencies['system'][7001]['update_test_1'] == 7002, 'An update function that depends on more than one update from the same module only has the dependency on the higher-numbered update function recorded.');
}
}
diff --git a/modules/simpletest/tests/upgrade/upgrade.poll.test b/modules/simpletest/tests/upgrade/upgrade.poll.test
index b1df28283..24245e4e4 100644
--- a/modules/simpletest/tests/upgrade/upgrade.poll.test
+++ b/modules/simpletest/tests/upgrade/upgrade.poll.test
@@ -31,7 +31,7 @@ class PollUpgradePathTestCase extends UpgradePathTestCase {
* Test a successful upgrade.
*/
public function testPollUpgrade() {
- $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
+ $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Check modules page for poll
$this->drupalGet('admin/modules');
@@ -43,22 +43,24 @@ class PollUpgradePathTestCase extends UpgradePathTestCase {
$nbchoices = ($i % 4) + 2;
for ($c = 0; $c < $nbchoices; $c++) {
- $this->assertText("Choice $c for poll $i", t('Choice text is displayed correctly on poll view'));
+ $this->assertText("Choice $c for poll $i", 'Choice text is displayed correctly on poll view');
}
// Now check that the votes are correct
$this->clickLink(t('Results'));
for ($c = 0; $c < $nbchoices; $c++) {
- $this->assertText("Choice $c for poll $i", t('Choice text is displayed correctly on result view'));
+ $this->assertText("Choice $c for poll $i", 'Choice text is displayed correctly on result view');
}
- $nbvotes = floor (($i % 4) + 5);
+ $nbvotes = floor(($i % 4) + 5);
$elements = $this->xpath("//div[@class='percent']");
for ($c = 0; $c < $nbchoices; $c++) {
$votes = floor($nbvotes / $nbchoices);
- if (($nbvotes % $nbchoices) > $c) $votes++;
- $this->assertTrue(preg_match("/$votes vote/", $elements[$c]), t('The number of votes is displayed correctly: expected ' . $votes . ', got ' . $elements[$c]));
+ if (($nbvotes % $nbchoices) > $c) {
+ $votes++;
+ }
+ $this->assertTrue(preg_match("/$votes vote/", $elements[$c]), 'The number of votes is displayed correctly: expected ' . $votes . ', got ' . $elements[$c]);
}
}
}
diff --git a/modules/simpletest/tests/upgrade/upgrade.test b/modules/simpletest/tests/upgrade/upgrade.test
index d0a3bc885..1d134f278 100644
--- a/modules/simpletest/tests/upgrade/upgrade.test
+++ b/modules/simpletest/tests/upgrade/upgrade.test
@@ -197,7 +197,8 @@ abstract class UpgradePathTestCase extends DrupalWebTestCase {
}
// Since cache_bootstrap won't exist in a Drupal 6 site, ignore the
// exception if the above fails.
- catch (Exception $e) {}
+ catch (Exception $e) {
+ }
}
/**
@@ -257,7 +258,7 @@ abstract class UpgradePathTestCase extends DrupalWebTestCase {
// Check if there still are pending updates.
$this->drupalGet($update_url, array('external' => TRUE));
$this->drupalPost(NULL, array(), t('Continue'));
- if (!$this->assertText(t('No pending updates.'), t('No pending updates at the end of the update process.'))) {
+ if (!$this->assertText(t('No pending updates.'), 'No pending updates at the end of the update process.')) {
return FALSE;
}
@@ -340,14 +341,14 @@ class BasicUpgradePath extends UpgradePathTestCase {
// Destroy a table that the upgrade process needs.
db_drop_table('access');
// Assert that the upgrade fails.
- $this->assertFalse($this->performUpgrade(FALSE), t('A failed upgrade should return messages.'));
+ $this->assertFalse($this->performUpgrade(FALSE), 'A failed upgrade should return messages.');
}
/**
* Test a successful upgrade.
*/
public function testBasicUpgrade() {
- $this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
+ $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.');
// Hit the frontpage.
$this->drupalGet('');
@@ -356,7 +357,7 @@ class BasicUpgradePath extends UpgradePathTestCase {
// Verify that we are still logged in.
$this->drupalGet('user');
$this->clickLink(t('Edit'));
- $this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), t('We are still logged in as admin at the end of the upgrade.'));
+ $this->assertEqual($this->getUrl(), url('user/1/edit', array('absolute' => TRUE)), 'We are still logged in as admin at the end of the upgrade.');
// Logout and verify that we can login back in with our initial password.
$this->drupalLogout();
@@ -367,7 +368,7 @@ class BasicUpgradePath extends UpgradePathTestCase {
));
// Test that the site name is correctly displayed.
- $this->assertText('Drupal 6', t('The site name is correctly displayed.'));
+ $this->assertText('Drupal 6', 'The site name is correctly displayed.');
// Verify that the main admin sections are available.
$this->drupalGet('admin');
diff --git a/modules/simpletest/tests/xmlrpc.test b/modules/simpletest/tests/xmlrpc.test
index 8ba943855..f057eac78 100644
--- a/modules/simpletest/tests/xmlrpc.test
+++ b/modules/simpletest/tests/xmlrpc.test
@@ -129,7 +129,7 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
$int_5 = mt_rand(-100, 100);
$bool_5 = (($int_5 % 2) == 0);
$string_5 = $this->randomName();
- $double_5 = (double)(mt_rand(-1000, 1000) / 100);
+ $double_5 = (double) (mt_rand(-1000, 1000) / 100);
$time_5 = REQUEST_TIME;
$base64_5 = $this->randomName(100);
$l_res_5 = xmlrpc_test_manyTypesTest($int_5, $bool_5, $string_5, $double_5, xmlrpc_date($time_5), $base64_5);
@@ -214,7 +214,7 @@ class XMLRPCMessagesTestCase extends DrupalWebTestCase {
$xml_message_l = xmlrpc_test_message_sized_in_kb($size);
$xml_message_r = xmlrpc($xml_url, 'messages.messageSizedInKB', $size);
- $this->assertEqual($xml_message_l, $xml_message_r, t('XML-RPC messages.messageSizedInKB of %s Kb size received', array('%s' => $size)));
+ $this->assertEqual($xml_message_l, $xml_message_r, 'XML-RPC messages.messageSizedInKB of ' . $size . ' Kb size received');
}
}
}