protected function I18nFieldPlaceholderTestCase::fieldUIAddNewField in Field placeholder 7.2
Same name and namespace in other branches
- 7 i18n_field_placeholder/i18n_field_placeholder.test \I18nFieldPlaceholderTestCase::fieldUIAddNewField()
Creates a new field through the Field UI.
Parameters
string $bundle_path: Admin path of the bundle that the new field is to be attached to.
string $initial_edit: $edit parameter for drupalPost() on the first step ('Manage fields' screen).
array $field_edit: $edit parameter for drupalPost() on the second step ('Field settings' form).
array $instance_edit: $edit parameter for drupalPost() on the third step ('Instance settings' form).
1 call to I18nFieldPlaceholderTestCase::fieldUIAddNewField()
- I18nFieldPlaceholderTestCase::testFieldPlaceholderTranslation in i18n_field_placeholder/
i18n_field_placeholder.test - Test the translation of text fields.
File
- i18n_field_placeholder/
i18n_field_placeholder.test, line 59
Class
Code
protected function fieldUIAddNewField($bundle_path, $initial_edit, $field_edit = array(), $instance_edit = array()) {
// Use 'test_field' field type by default.
$initial_edit += array(
'fields[_add_new_field][type]' => 'test_field',
'fields[_add_new_field][widget_type]' => 'test_field_widget',
);
$label = $initial_edit['fields[_add_new_field][label]'];
$field_name = $initial_edit['fields[_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.'));
// 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.'));
// 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.'));
// 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.'));
}