From f57fa290366339123d42c4b93705d3f83f05db18 Mon Sep 17 00:00:00 2001 From: Lars Toomre Date: Thu, 27 Sep 2012 20:47:53 -0400 Subject: [PATCH] Remove t() from assert messages in tests of Form sub-system. --- .../lib/Drupal/system/Tests/Form/AlterTest.php | 2 +- .../lib/Drupal/system/Tests/Form/CheckboxTest.php | 14 +++--- .../lib/Drupal/system/Tests/Form/ElementTest.php | 6 +- .../system/Tests/Form/ElementsLabelsTest.php | 30 +++++++------- .../system/Tests/Form/ElementsTableSelectTest.php | 44 ++++++++++---------- .../system/Tests/Form/ElementsVerticalTabsTest.php | 2 +- .../lib/Drupal/system/Tests/Form/EmailTest.php | 4 +- .../lib/Drupal/system/Tests/Form/FormTest.php | 18 ++++---- .../Tests/Form/LanguageSelectElementTest.php | 8 ++-- .../Drupal/system/Tests/Form/ProgrammaticTest.php | 4 +- .../lib/Drupal/system/Tests/Form/RebuildTest.php | 20 ++++---- .../Tests/Form/StateValuesCleanAdvancedTest.php | 6 +- .../system/Tests/Form/StateValuesCleanTest.php | 20 ++++---- .../lib/Drupal/system/Tests/Form/StorageTest.php | 6 +- .../system/Tests/Form/TriggeringElementTest.php | 30 +++++++------- .../Drupal/system/Tests/Form/ValidationTest.php | 20 ++++---- .../lib/Drupal/system/Tests/Form/WrapperTest.php | 4 +- 17 files changed, 119 insertions(+), 119 deletions(-) diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/AlterTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/AlterTest.php index 3e45d5b..70d9b5e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/AlterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/AlterTest.php @@ -43,6 +43,6 @@ class AlterTest extends WebTestBase { '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.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/CheckboxTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/CheckboxTest.php index df0171b..256746c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/CheckboxTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/CheckboxTest.php @@ -58,7 +58,7 @@ class CheckboxTest extends WebTestBase { $checked = ($default_value === '1foobar'); } $checked_in_html = strpos($form, 'checked') !== FALSE; - $message = t('#default_value is %default_value #return_value is %return_value.', array('%default_value' => var_export($default_value, TRUE), '%return_value' => var_export($return_value, TRUE))); + $message = format_string('#default_value is %default_value #return_value is %return_value.', array('%default_value' => var_export($default_value, TRUE), '%return_value' => var_export($return_value, TRUE))); $this->assertIdentical($checked, $checked_in_html, $message); } } @@ -66,12 +66,12 @@ class CheckboxTest extends WebTestBase { // Ensure that $form_state['values'] is populated correctly for a checkboxes // group that includes a 0-indexed array of options. $results = json_decode($this->drupalPost('form-test/checkboxes-zero', array(), 'Save')); - $this->assertIdentical($results->checkbox_off, array(0, 0, 0), t('All three in checkbox_off are zeroes: off.')); - $this->assertIdentical($results->checkbox_zero_default, array('0', 0, 0), t('The first choice is on in checkbox_zero_default')); - $this->assertIdentical($results->checkbox_string_zero_default, array('0', 0, 0), t('The first choice is on in checkbox_string_zero_default')); + $this->assertIdentical($results->checkbox_off, array(0, 0, 0), 'All three in checkbox_off are zeroes: off.'); + $this->assertIdentical($results->checkbox_zero_default, array('0', 0, 0), 'The first choice is on in checkbox_zero_default'); + $this->assertIdentical($results->checkbox_string_zero_default, array('0', 0, 0), 'The first choice is on in checkbox_string_zero_default'); $edit = array('checkbox_off[0]' => '0'); $results = json_decode($this->drupalPost('form-test/checkboxes-zero', $edit, 'Save')); - $this->assertIdentical($results->checkbox_off, array('0', 0, 0), t('The first choice is on in checkbox_off but the rest is not')); + $this->assertIdentical($results->checkbox_off, array('0', 0, 0), 'The first choice is on in checkbox_off but the rest is not'); // Ensure that each checkbox is rendered correctly for a checkboxes group // that includes a 0-indexed array of options. @@ -80,7 +80,7 @@ class CheckboxTest extends WebTestBase { foreach ($checkboxes as $checkbox) { $checked = isset($checkbox['checked']); $name = (string) $checkbox['name']; - $this->assertIdentical($checked, $name == 'checkbox_zero_default[0]' || $name == 'checkbox_string_zero_default[0]', t('Checkbox %name correctly checked', array('%name' => $name))); + $this->assertIdentical($checked, $name == 'checkbox_zero_default[0]' || $name == 'checkbox_string_zero_default[0]', format_string('Checkbox %name correctly checked', array('%name' => $name))); } $edit = array('checkbox_off[0]' => '0'); $this->drupalPost('form-test/checkboxes-zero/0', $edit, 'Save'); @@ -88,7 +88,7 @@ class CheckboxTest extends WebTestBase { foreach ($checkboxes as $checkbox) { $checked = isset($checkbox['checked']); $name = (string) $checkbox['name']; - $this->assertIdentical($checked, $name == 'checkbox_off[0]' || $name == 'checkbox_zero_default[0]' || $name == 'checkbox_string_zero_default[0]', t('Checkbox %name correctly checked', array('%name' => $name))); + $this->assertIdentical($checked, $name == 'checkbox_off[0]' || $name == 'checkbox_zero_default[0]' || $name == 'checkbox_string_zero_default[0]', format_string('Checkbox %name correctly checked', array('%name' => $name))); } } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/ElementTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/ElementTest.php index 3c4c4af..621578c 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/ElementTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/ElementTest.php @@ -41,7 +41,7 @@ class ElementTest extends WebTestBase { ':id' => 'edit-' . $type, ':expected' => $expected, )); - $this->assertTrue(!empty($element), t('Placeholder text placed in @type.', array('@type' => $type))); + $this->assertTrue(!empty($element), format_string('Placeholder text placed in @type.', array('@type' => $type))); } // Test to make sure textarea has the proper placeholder text. @@ -49,7 +49,7 @@ class ElementTest extends WebTestBase { ':id' => 'edit-textarea', ':expected' => $expected, )); - $this->assertTrue(!empty($element), t('Placeholder text placed in textarea.')); + $this->assertTrue(!empty($element), 'Placeholder text placed in textarea.'); } /** @@ -87,7 +87,7 @@ class ElementTest extends WebTestBase { ':id' => 'edit-' . $type . '-foo', ':class' => 'description', )); - $this->assertTrue(count($elements), t('Custom %type option description found.', array( + $this->assertTrue(count($elements), format_string('Custom %type option description found.', array( '%type' => $type, ))); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/ElementsLabelsTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/ElementsLabelsTest.php index 7fcc45f..b36b3c0 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/ElementsLabelsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/ElementsLabelsTest.php @@ -39,57 +39,57 @@ class ElementsLabelsTest extends WebTestBase { // 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.'); // Make sure the label is rendered for checkboxes. $elements = $this->xpath('//input[@id="edit-form-checkboxes-test-0"]/following-sibling::label[@for="edit-form-checkboxes-test-0" and @class="option"]'); - $this->assertTrue(isset($elements[0]), t("Label 0 found checkbox.")); + $this->assertTrue(isset($elements[0]), 'Label 0 found checkbox.'); $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.'); // Make sure the label is rendered for radios. $elements = $this->xpath('//input[@id="edit-form-radios-test-0"]/following-sibling::label[@for="edit-form-radios-test-0" and @class="option"]'); - $this->assertTrue(isset($elements[0]), t("Label 0 found radios.")); + $this->assertTrue(isset($elements[0]), 'Label 0 found radios.'); // Exercise various defaults for checkboxes and modifications to ensure // appropriate override and correct behavior. $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 behavior. $elements = $this->xpath('//label[@for="edit-form-textfield-test-title-and-required"]/child::abbr[@class="form-required"]/parent::*/following-sibling::input[@id="edit-form-textfield-test-title-and-required"]'); - $this->assertTrue(isset($elements[0]), t("Label precedes textfield, with required marker inside label.")); + $this->assertTrue(isset($elements[0]), 'Label precedes 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"]/abbr[@class="form-required"]'); - $this->assertTrue(isset($elements[0]), t("Label tag with required marker precedes required textfield with no title.")); + $this->assertTrue(isset($elements[0]), 'Label tag with required marker precedes required textfield with no title.'); $elements = $this->xpath('//input[@id="edit-form-textfield-test-title-invisible"]/preceding-sibling::label[@for="edit-form-textfield-test-title-invisible" and @class="element-invisible"]'); - $this->assertTrue(isset($elements[0]), t("Label preceding field and label class is element-invisible.")); + $this->assertTrue(isset($elements[0]), 'Label preceding field and label class is element-invisible.'); $elements = $this->xpath('//input[@id="edit-form-textfield-test-title"]/preceding-sibling::abbr[@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('//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.'); // Check title attribute for radios and checkboxes. $elements = $this->xpath('//div[@id="edit-form-checkboxes-title-attribute"]'); diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/ElementsTableSelectTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/ElementsTableSelectTest.php index 67c0694..d778669 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/ElementsTableSelectTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/ElementsTableSelectTest.php @@ -36,14 +36,14 @@ class ElementsTableSelectTest extends WebTestBase { $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, format_string('Checkbox for value @row.', array('@row' => $row))); } } @@ -53,14 +53,14 @@ class ElementsTableSelectTest extends WebTestBase { 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, format_string('Radio button for value @row.', array('@row' => $row))); } } @@ -94,7 +94,7 @@ class ElementsTableSelectTest extends WebTestBase { */ 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.'); } /** @@ -107,18 +107,18 @@ class ElementsTableSelectTest extends WebTestBase { $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.'); } @@ -128,7 +128,7 @@ class ElementsTableSelectTest extends WebTestBase { 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'); } /** @@ -137,18 +137,18 @@ class ElementsTableSelectTest extends WebTestBase { 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.'); } @@ -167,11 +167,11 @@ class ElementsTableSelectTest extends WebTestBase { // Test with a valid value. list($processed_form, $form_state, $errors) = $this->formSubmitHelper($form, array('tableselect' => array('row1' => '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' => array('non_existing_value' => '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.'); } @@ -192,11 +192,11 @@ class ElementsTableSelectTest extends WebTestBase { // 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.'); } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/ElementsVerticalTabsTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/ElementsVerticalTabsTest.php index 9c16ec3..2087295 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/ElementsVerticalTabsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/ElementsVerticalTabsTest.php @@ -38,6 +38,6 @@ class ElementsVerticalTabsTest extends WebTestBase { $this->drupalGet('form_test/vertical-tabs'); $position1 = strpos($this->content, 'core/misc/vertical-tabs.js'); $position2 = strpos($this->content, 'core/misc/collapse.js'); - $this->assertTrue($position1 !== FALSE && $position2 !== FALSE && $position1 < $position2, t('vertical-tabs.js is included before collapse.js')); + $this->assertTrue($position1 !== FALSE && $position2 !== FALSE && $position1 < $position2, 'vertical-tabs.js is included before collapse.js'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/EmailTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/EmailTest.php index f0dcd99..2462dfd 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/EmailTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/EmailTest.php @@ -39,8 +39,8 @@ class EmailTest extends WebTestBase { $edit['email'] = 'invalid'; $edit['email_required'] = ' '; $this->drupalPost('form-test/email', $edit, 'Submit'); - $this->assertRaw(t('The e-mail address %mail is not valid.', array('%mail' => 'invalid'))); - $this->assertRaw(t('!name field is required.', array('!name' => 'Address'))); + $this->assertRaw(format_string('The e-mail address %mail is not valid.', array('%mail' => 'invalid'))); + $this->assertRaw(format_string('!name field is required.', array('!name' => 'Address'))); $edit = array(); $edit['email_required'] = ' foo.bar@example.com '; diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php index 2586aa3..1b4538e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php @@ -260,7 +260,7 @@ class FormTest extends WebTestBase { // 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'))); @@ -273,7 +273,7 @@ class FormTest extends WebTestBase { '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( + $this->assertEqual($values[$widget], $expected_value, format_string('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), @@ -337,7 +337,7 @@ class FormTest extends WebTestBase { 'multiple_no_default_required' => array('three' => 'three'), ); foreach ($expected as $key => $value) { - $this->assertIdentical($values[$key], $value, t('@name: @actual is equal to @expected.', array( + $this->assertIdentical($values[$key], $value, format_string('@name: @actual is equal to @expected.', array( '@name' => $key, '@actual' => var_export($values[$key], TRUE), '@expected' => var_export($value, TRUE), @@ -531,7 +531,7 @@ class FormTest extends WebTestBase { // 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], format_string('Default value for %type: expected %expected, returned %returned.', array('%type' => $key, '%expected' => var_export($expected_value, TRUE), '%returned' => var_export($values[$key], TRUE)))); } // Recurse children. @@ -582,7 +582,7 @@ class FormTest extends WebTestBase { ':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]), format_string('Disabled form element class found for #type %type.', array('%type' => $item['#type']))); } // Verify special element #type text-format. @@ -595,7 +595,7 @@ class FormTest extends WebTestBase { ':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]), format_string('Disabled form element class found for #type %type.', array('%type' => 'text_format[format]'))); } /** @@ -608,7 +608,7 @@ class FormTest extends WebTestBase { $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.'); } /** @@ -623,7 +623,7 @@ class FormTest extends WebTestBase { ':id' => 'edit-' . $type, ':expected' => $expected, )); - $this->assertTrue(!empty($element), t('The @type has the proper required attribute.', array('@type' => $type))); + $this->assertTrue(!empty($element), format_string('The @type has the proper required attribute.', array('@type' => $type))); } // Test to make sure textarea has the proper required attribute. @@ -631,6 +631,6 @@ class FormTest extends WebTestBase { ':id' => 'edit-textarea', ':expected' => $expected, )); - $this->assertTrue(!empty($element), t('The textarea has the proper required attribute.')); + $this->assertTrue(!empty($element), 'The textarea has the proper required attribute.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php index 200735e..f5c589b 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/LanguageSelectElementTest.php @@ -54,7 +54,7 @@ class LanguageSelectElementTest extends WebTestBase { 'edit-languages-locked' => LANGUAGE_LOCKED, 'edit-languages-config-and-locked' => LANGUAGE_CONFIGURABLE | LANGUAGE_LOCKED); foreach ($ids as $id => $flags) { - $this->assertField($id, t('The @id field was found on the page.', array('@id' => $id))); + $this->assertField($id, format_string('The @id field was found on the page.', array('@id' => $id))); $options = array(); foreach (language_list($flags) as $langcode => $language) { $options[$langcode] = $language->locked ? t('- @name -', array('@name' => $language->name)) : $language->name; @@ -63,7 +63,7 @@ class LanguageSelectElementTest extends WebTestBase { } // Test that the #options were not altered by #languages. - $this->assertField('edit-language-custom-options', t('The @id field was found on the page.', array('@id' => 'edit-language-custom-options'))); + $this->assertField('edit-language-custom-options', format_string('The @id field was found on the page.', array('@id' => 'edit-language-custom-options'))); $this->_testLanguageSelectElementOptions('edit-language-custom-options', array('opt1' => 'First option', 'opt2' => 'Second option', 'opt3' => 'Third option')); } @@ -80,7 +80,7 @@ class LanguageSelectElementTest extends WebTestBase { // Check that the language fields were rendered on the page. $ids = array('edit-languages-all', 'edit-languages-configurable', 'edit-languages-locked', 'edit-languages-config-and-locked'); foreach ($ids as $id) { - $this->assertNoField($id, t('The @id field was not found on the page.', array('@id' => $id))); + $this->assertNoField($id, format_string('The @id field was not found on the page.', array('@id' => $id))); } // Check that the submitted values were the default values of the language @@ -115,6 +115,6 @@ class LanguageSelectElementTest extends WebTestBase { $this->assertEqual((string) $option, $option_title); next($options); } - $this->assertEqual($count, count($options), t('The number of languages and the number of options shown by the language element are the same: @languages languages, @number options', array('@languages' => count($options), '@number' => $count))); + $this->assertEqual($count, count($options), format_string('The number of languages and the number of options shown by the language element are the same: @languages languages, @number options', array('@languages' => count($options), '@number' => $count))); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/ProgrammaticTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/ProgrammaticTest.php index 3f5a684..8e5880a 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/ProgrammaticTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/ProgrammaticTest.php @@ -87,7 +87,7 @@ class ProgrammaticTest extends WebTestBase { '%values' => print_r($values, TRUE), '%errors' => $valid_form ? t('None') : implode(' ', $errors), ); - $this->assertTrue($valid_input == $valid_form, t('Input values: %values
Validation handler errors: %errors', $args)); + $this->assertTrue($valid_input == $valid_form, format_string('Input values: %values
Validation handler errors: %errors', $args)); // We check submitted values only if we have a valid input. if ($valid_input) { @@ -95,7 +95,7 @@ class ProgrammaticTest extends WebTestBase { // 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, format_string('Submission handler correctly executed: %stored_key is %stored_value', array('%stored_key' => $key, '%stored_value' => print_r($value, TRUE)))); } } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/RebuildTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/RebuildTest.php index 9d4c439..3c0c0c5 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/RebuildTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/RebuildTest.php @@ -52,14 +52,14 @@ class RebuildTest extends WebTestBase { $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.'); } /** @@ -93,7 +93,7 @@ class RebuildTest extends WebTestBase { // field items in the field for which we just added an item. $this->drupalGet('node/add/page'); $this->drupalPostAJAX(NULL, array(), array('field_ajax_test_add_more' => t('Add another item')), 'system/ajax', array(), array(), 'page-node-form'); - $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 @@ -101,14 +101,14 @@ class RebuildTest extends WebTestBase { // 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 contains two items in the multi-valued field, so we // know we're testing a form that was correctly retrieved from cache. - $this->assert(count($this->xpath('//form[contains(@id, "page-node-form")]//div[contains(@class, "form-item-field-ajax-test")]//input[@type="text"]')) == 2, t('Form retained its state from cache.')); + $this->assert(count($this->xpath('//form[contains(@id, "page-node-form")]//div[contains(@class, "form-item-field-ajax-test")]//input[@type="text"]')) == 2, 'Form retained its state from cache.'); // 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.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanAdvancedTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanAdvancedTest.php index 630a902..ceae2af 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanAdvancedTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanAdvancedTest.php @@ -44,7 +44,7 @@ class StateValuesCleanAdvancedTest extends WebTestBase { $this->image = current($image_files); // Check if the physical file is there. - $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."); // "Browse" for the desired file. $edit = array('files[image]' => drupal_realpath($this->image->uri)); @@ -53,7 +53,7 @@ class StateValuesCleanAdvancedTest extends WebTestBase { $this->drupalPost('form_test/form-state-values-clean-advanced', $edit, t('Submit')); // Expecting a 200 HTTP code. - $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.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanTest.php index bb9cc2e..02ec53a 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/StateValuesCleanTest.php @@ -42,21 +42,21 @@ class StateValuesCleanTest extends WebTestBase { ); // 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']), format_string('%element was removed.', array('%element' => 'form_id'))); + $this->assertFalse(isset($values['form_token']), format_string('%element was removed.', array('%element' => 'form_token'))); + $this->assertFalse(isset($values['form_build_id']), format_string('%element was removed.', array('%element' => 'form_build_id'))); + $this->assertFalse(isset($values['op']), format_string('%element was removed.', array('%element' => 'op'))); // 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']), format_string('%element was removed.', array('%element' => 'foo'))); + $this->assertFalse(isset($values['bar']), format_string('%element was removed.', array('%element' => 'bar'))); + $this->assertFalse(isset($values['baz']['foo']), format_string('%element was removed.', array('%element' => 'foo'))); + $this->assertFalse(isset($values['baz']['baz']), format_string('%element was removed.', array('%element' => 'baz'))); // 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.'); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/StorageTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/StorageTest.php index 2b1daf9..07e902e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/StorageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/StorageTest.php @@ -65,7 +65,7 @@ class StorageTest extends WebTestBase { $this->drupalPost(NULL, $edit, 'Save'); $this->assertText('Form constructions: 4'); - $this->assertText('Title: new', t('The form storage has stored the values.')); + $this->assertText('Title: new', 'The form storage has stored the values.'); } /** @@ -89,7 +89,7 @@ class StorageTest extends WebTestBase { $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.'); } /** @@ -97,7 +97,7 @@ class StorageTest extends WebTestBase { */ 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.'); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/TriggeringElementTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/TriggeringElementTest.php index 25245e9..495044f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/TriggeringElementTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/TriggeringElementTest.php @@ -43,7 +43,7 @@ class TriggeringElementTest extends WebTestBase { // $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->assertText('There is no clicked button.', format_string('$form_state[\'triggering_element\'] set to NULL.')); $this->assertNoText('Submit handler for form_test_clicked_button executed.', t('Form submit handler did not execute.')); // Ensure submitting a form with one or more submit buttons results in @@ -51,16 +51,16 @@ class TriggeringElementTest extends WebTestBase { // 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.', format_string('$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.', format_string('$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.', format_string('$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, @@ -68,16 +68,16 @@ class TriggeringElementTest extends WebTestBase { // 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.', format_string('$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.', format_string('$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.', format_string('$form_state[\'triggering_element\'] set to first button.')); + $this->assertText('Submit handler for form_test_clicked_button executed.', 'Form submit handler executed.'); } /** @@ -105,7 +105,7 @@ class TriggeringElementTest extends WebTestBase { // 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.', format_string('$form_state[\'triggering_element\'] not set to a restricted button.')); + $this->assertText('The clicked button is button2.', format_string('$form_state[\'triggering_element\'] not set to a restricted button.')); } } diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/ValidationTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/ValidationTest.php index 7491df2..dfb99ce 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/ValidationTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/ValidationTest.php @@ -40,8 +40,8 @@ class ValidationTest extends WebTestBase { '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. @@ -49,8 +49,8 @@ class ValidationTest extends WebTestBase { '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. @@ -58,13 +58,13 @@ class ValidationTest extends WebTestBase { 'name' => 'element_validate_access', ); $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->assertNoFieldByName('name', 'Form element was hidden.'); + $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->assertNoFieldByName('name', 'Form element was hidden.'); + $this->assertText('Name value: element_validate_access', 'Value for inaccessible form element exists.'); } /** @@ -88,14 +88,14 @@ class ValidationTest extends WebTestBase { ':id' => 'edit-' . $type, ':expected' => $expected, )); - $this->assertTrue(!empty($element), t('The @type button has the proper formnovalidate attribute.', array('@type' => $type))); + $this->assertTrue(!empty($element), format_string('The @type button has the proper formnovalidate attribute.', array('@type' => $type))); } // The button with full server-side validation should not have the // 'formnovalidate' attribute. $element = $this->xpath('//input[@id=:id and not(@formnovalidate)]', array( ':id' => 'edit-full', )); - $this->assertTrue(!empty($element), t('The button with full server-side validation does not have the formnovalidate attribute.')); + $this->assertTrue(!empty($element), 'The button with full server-side validation does not have the formnovalidate attribute.'); // Submit the form by pressing the 'Partial validate' button (uses // #limit_validation_errors) and ensure that the title field is not diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/WrapperTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/WrapperTest.php index 638c480..142c49a 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/WrapperTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/WrapperTest.php @@ -34,7 +34,7 @@ class WrapperTest extends WebTestBase { */ 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.'); } } -- 1.7.6.msysgit.0