diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-08-05 23:26:36 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-08-05 23:26:36 +0000 |
commit | cacd044a6398df92de68c5aea31987ac0fff507a (patch) | |
tree | 41305d208c037ae0aad0c68fb23beb66715f145a /modules/field_ui/field_ui.test | |
parent | efbf061c8142c201967389eac42e8284dfa9aff9 (diff) | |
download | brdo-cacd044a6398df92de68c5aea31987ac0fff507a.tar.gz brdo-cacd044a6398df92de68c5aea31987ac0fff507a.tar.bz2 |
#500866 by boombatower, solotandem: Remove t() from assertion messages in SimpleTest, so translators do not get 1000s of bogus strings.
Diffstat (limited to 'modules/field_ui/field_ui.test')
-rw-r--r-- | modules/field_ui/field_ui.test | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/modules/field_ui/field_ui.test b/modules/field_ui/field_ui.test index 5baaa341a..2274b75de 100644 --- a/modules/field_ui/field_ui.test +++ b/modules/field_ui/field_ui.test @@ -10,7 +10,7 @@ * Field UI tests. */ class FieldUITestCase extends DrupalWebTestCase { - public static function getInfo() { + public static function getInfo() { return array( 'name' => 'Field UI tests', 'description' => 'Test the field UI functionality.', @@ -26,7 +26,7 @@ class FieldUITestCase extends DrupalWebTestCase { $this->drupalLogin($admin_user); // Create content type, with underscores. - $type_name = strtolower($this->randomName(8)) . '_' .'test'; + $type_name = strtolower($this->randomName(8)) . '_' . 'test'; $type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name)); $this->type = $type->type; // Store a valid URL name, with hyphens instead of underscores. @@ -35,7 +35,7 @@ class FieldUITestCase extends DrupalWebTestCase { // Create random field name. $this->field_label = $this->randomName(8); $this->field_name_input = strtolower($this->randomName(8)); - $this->field_name = 'field_'. $this->field_name_input; + $this->field_name = 'field_' . $this->field_name_input; } /** @@ -66,13 +66,13 @@ class FieldUITestCase extends DrupalWebTestCase { ); foreach ($table_headers as $table_header) { // We check that the label appear in the table headings. - $this->assertRaw($table_header . '</th>', t('%table_header table header was found.', array('%table_header' => $table_header))); + $this->assertRaw($table_header . '</th>', $table_header . ' table header was found.'); } // "Add new field" and "Add existing field" aren't a table heading so just // test the text. foreach (array('Add new field', 'Add existing field') as $element) { - $this->assertText($element, t('"@element" was found.', array('@element' => $element))); + $this->assertText($element, '"' . $element . '" was found.'); } } @@ -95,7 +95,7 @@ class FieldUITestCase extends DrupalWebTestCase { // should also appear in the 'taxonomy term' entity. $vocabulary = taxonomy_vocabulary_load(1); $this->drupalGet('admin/structure/taxonomy/' . $vocabulary->machine_name . '/fields'); - $this->assertTrue($this->xpath('//select[@name="_add_existing_field[field_name]"]//option[@value="' . $this->field_name . '"]'), t('Existing field was found in account settings.')); + $this->assertTrue($this->xpath('//select[@name="_add_existing_field[field_name]"]//option[@value="' . $this->field_name . '"]'), 'Existing field was found in account settings.'); } /** @@ -118,7 +118,7 @@ class FieldUITestCase extends DrupalWebTestCase { $this->assertFieldSettings($this->type, $this->field_name, $string); // Assert redirection back to the "manage fields" page. - $this->assertText(t('Saved @label configuration.', array('@label' => $this->field_label)), t('Redirected to "Manage fields" page.')); + $this->assertText(t('Saved @label configuration.', array('@label' => $this->field_label)), 'Redirected to "Manage fields" page.'); } /** @@ -127,12 +127,12 @@ class FieldUITestCase extends DrupalWebTestCase { function addExistingField() { // Check "Add existing field" appears. $this->drupalGet('admin/structure/types/manage/page/fields'); - $this->assertRaw(t('Add existing field'), t('"Add existing field" was found.')); + $this->assertRaw(t('Add existing field'), '"Add existing field" was found.'); // Check that the list of options respects entity type restrictions on // fields. The 'comment' field is restricted to the 'comment' entity type // and should not appear in the list. - $this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value="comment"]'), t('The list of options respects entity type restrictions.')); + $this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value="comment"]'), 'The list of options respects entity type restrictions.'); // Add a new field based on an existing field. $edit = array( @@ -159,12 +159,12 @@ class FieldUITestCase extends DrupalWebTestCase { _field_info_collate_fields(TRUE); // Assert field settings. $field = field_info_field($field_name); - $this->assertTrue($field['settings']['test_field_setting'] == $string, t('Field settings were found.')); + $this->assertTrue($field['settings']['test_field_setting'] == $string, 'Field settings were found.'); // Assert instance and widget settings. $instance = field_info_instance($entity_type, $field_name, $bundle); - $this->assertTrue($instance['settings']['test_instance_setting'] == $string, t('Field instance settings were found.')); - $this->assertTrue($instance['widget']['settings']['test_widget_setting'] == $string, t('Field widget settings were found.')); + $this->assertTrue($instance['settings']['test_instance_setting'] == $string, 'Field instance settings were found.'); + $this->assertTrue($instance['widget']['settings']['test_widget_setting'] == $string, 'Field widget settings were found.'); } /** @@ -190,31 +190,31 @@ class FieldUITestCase extends DrupalWebTestCase { $element_id = "edit-$field_name-$langcode-0-value"; $element_name = "{$field_name}[$langcode][0][value]"; $this->drupalGet($admin_path); - $this->assertFieldById($element_id, '', t('The default value widget was empty.')); + $this->assertFieldById($element_id, '', 'The default value widget was empty.'); // Check that invalid default values are rejected. $edit = array($element_name => '-1'); $this->drupalPost($admin_path, $edit, t('Save settings')); - $this->assertText("$field_name does not accept the value -1", t('Form vaildation failed.')); + $this->assertText("$field_name does not accept the value -1", 'Form vaildation failed.'); // Check that the default value is saved. $edit = array($element_name => '1'); $this->drupalPost($admin_path, $edit, t('Save settings')); - $this->assertText("Saved $field_name configuration", t('The form was successfully submitted.')); + $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.'); $instance = field_info_instance('node', $field_name, $this->type); - $this->assertEqual($instance['default_value'], array(array('value' => 1)), t('The default value was correctly saved.')); + $this->assertEqual($instance['default_value'], array(array('value' => 1)), 'The default value was correctly saved.'); // Check that the default value shows up in the form $this->drupalGet($admin_path); - $this->assertFieldById($element_id, '1', t('The default value widget was displayed with the correct value.')); + $this->assertFieldById($element_id, '1', 'The default value widget was displayed with the correct value.'); // Check that the default value can be emptied. $edit = array($element_name => ''); $this->drupalPost(NULL, $edit, t('Save settings')); - $this->assertText("Saved $field_name configuration", t('The form was successfully submitted.')); + $this->assertText("Saved $field_name configuration", 'The form was successfully submitted.'); field_info_cache_clear(); $instance = field_info_instance('node', $field_name, $this->type); - $this->assertEqual($instance['default_value'], NULL, t('The default value was correctly saved.')); + $this->assertEqual($instance['default_value'], NULL, 'The default value was correctly saved.'); } /** @@ -230,7 +230,7 @@ class FieldUITestCase extends DrupalWebTestCase { $this->fieldUIAddNewField($bundle_path1, $edit1); // Create an additional node type. - $type_name2 = strtolower($this->randomName(8)) . '_' .'test'; + $type_name2 = strtolower($this->randomName(8)) . '_' . 'test'; $type2 = $this->drupalCreateContentType(array('name' => $type_name2, 'type' => $type_name2)); $type_name2 = $type2->type; $hyphen_type2 = str_replace('_', '-', $type_name2); @@ -249,9 +249,9 @@ class FieldUITestCase extends DrupalWebTestCase { // Reset the fields info. _field_info_collate_fields(TRUE); // Check that the field instance was deleted. - $this->assertNull(field_info_instance('node', $this->field_name, $this->type), t('Field instance was deleted.')); + $this->assertNull(field_info_instance('node', $this->field_name, $this->type), 'Field instance was deleted.'); // Check that the field was not deleted - $this->assertNotNull(field_info_field($this->field_name), t('Field was not deleted.')); + $this->assertNotNull(field_info_field($this->field_name), 'Field was not deleted.'); // Delete the second instance. $this->fieldUIDeleteField($bundle_path2, $this->field_name, $this->field_label, $type_name2); @@ -259,9 +259,9 @@ class FieldUITestCase extends DrupalWebTestCase { // Reset the fields info. _field_info_collate_fields(TRUE); // Check that the field instance was deleted. - $this->assertNull(field_info_instance('node', $this->field_name, $type_name2), t('Field instance was deleted.')); + $this->assertNull(field_info_instance('node', $this->field_name, $type_name2), 'Field instance was deleted.'); // Check that the field was deleted too. - $this->assertNull(field_info_field($this->field_name), t('Field was deleted.')); + $this->assertNull(field_info_field($this->field_name), 'Field was deleted.'); } /** @@ -272,7 +272,7 @@ class FieldUITestCase extends DrupalWebTestCase { // Check that the field type is not available in the 'add new field' row. $this->drupalGet($bundle_path); - $this->assertFalse($this->xpath('//select[@id="edit--add-new-field-type"]//option[@value="hidden_test_field"]'), t("The 'add new field' select respects field types 'no_ui' property.")); + $this->assertFalse($this->xpath('//select[@id="edit--add-new-field-type"]//option[@value="hidden_test_field"]'), "The 'add new field' select respects field types 'no_ui' property."); // Create a field and an instance programmatically. $field_name = 'hidden_test_field'; @@ -285,18 +285,18 @@ class FieldUITestCase extends DrupalWebTestCase { 'widget_type' => 'test_field_widget', ); field_create_instance($instance); - $this->assertTrue(field_read_instance('node', $field_name, $this->type), t('An instance of the field %field was created programmatically.', array('%field' => $field_name))); + $this->assertTrue(field_read_instance('node', $field_name, $this->type), 'An instance of the field ' . $field_name . ' was created programmatically.'); // Check that the newly added instance appears on the 'Manage Fields' // screen. $this->drupalGet($bundle_path); - $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $instance['label'], t('Field was created and appears in the overview page.')); + $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $instance['label'], 'Field was created and appears in the overview page.'); // Check that the instance does not appear in the 'add existing field' row // on other bundles. $bundle_path = 'admin/structure/types/manage/article/fields/'; $this->drupalGet($bundle_path); - $this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value=:field_name]', array(':field_name' => $field_name)), t("The 'add existing field' select respects field types 'no_ui' property.")); + $this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value=:field_name]', array(':field_name' => $field_name)), "The 'add existing field' select respects field types 'no_ui' property."); } /** @@ -324,22 +324,22 @@ class FieldUITestCase extends DrupalWebTestCase { $field_name = $initial_edit['_add_new_field[field_name]']; // First step : 'Add new field' on the 'Manage fields' page. - $this->drupalPost("$bundle_path/fields", $initial_edit, t('Save')); - $this->assertRaw(t('These settings apply to the %label field everywhere it is used.', array('%label' => $label)), t('Field settings page was displayed.')); + $this->drupalPost("$bundle_path/fields", $initial_edit, t('Save')); + $this->assertRaw(t('These settings apply to the %label field everywhere it is used.', array('%label' => $label)), 'Field settings page was displayed.'); // Second step : 'Field settings' form. $this->drupalPost(NULL, $field_edit, t('Save field settings')); - $this->assertRaw(t('Updated field %label field settings.', array('%label' => $label)), t('Redirected to instance and widget settings page.')); + $this->assertRaw(t('Updated field %label field settings.', array('%label' => $label)), 'Redirected to instance and widget settings page.'); // Assert the field settings are correct. $this->assertFieldSettings($this->type, $this->field_name); // Third step : 'Instance settings' form. $this->drupalPost(NULL, $instance_edit, t('Save settings')); - $this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), t('Redirected to "Manage fields" page.')); + $this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), 'Redirected to "Manage fields" page.'); // Check that the field appears in the overview form. - $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, t('Field was created and appears in the overview page.')); + $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, 'Field was created and appears in the overview page.'); } /** @@ -367,10 +367,10 @@ class FieldUITestCase extends DrupalWebTestCase { // Second step : 'Instance settings' form. $this->drupalPost(NULL, $instance_edit, t('Save settings')); - $this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), t('Redirected to "Manage fields" page.')); + $this->assertRaw(t('Saved %label configuration.', array('%label' => $label)), 'Redirected to "Manage fields" page.'); // Check that the field appears in the overview form. - $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, t('Field was created and appears in the overview page.')); + $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, 'Field was created and appears in the overview page.'); } /** @@ -388,13 +388,13 @@ class FieldUITestCase extends DrupalWebTestCase { function fieldUIDeleteField($bundle_path, $field_name, $label, $bundle_label) { // Display confirmation form. $this->drupalGet("$bundle_path/fields/$field_name/delete"); - $this->assertRaw(t('Are you sure you want to delete the field %label', array('%label' => $label)), t('Delete confirmation was found.')); + $this->assertRaw(t('Are you sure you want to delete the field %label', array('%label' => $label)), 'Delete confirmation was found.'); // Submit confirmation form. $this->drupalPost(NULL, array(), t('Delete')); - $this->assertRaw(t('The field %label has been deleted from the %type content type.', array('%label' => $label, '%type' => $bundle_label)), t('Delete message was found.')); + $this->assertRaw(t('The field %label has been deleted from the %type content type.', array('%label' => $label, '%type' => $bundle_label)), 'Delete message was found.'); // Check that the field doesn not appear in the overview form - $this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, t('Field does not appear in the overview page.')); + $this->assertNoFieldByXPath('//table[@id="field-overview"]//span[@class="label-field"]', $label, 'Field does not appear in the overview page.'); } } |