function MerciBaseTestCase::fieldUIAddNewField in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3
1 call to MerciBaseTestCase::fieldUIAddNewField()
- MerciEntityRefBehaviorTest::setUp in merci_entityref_behavior/tests/merci_entityref_behavior.test
- Implementation of setUp().
File
- merci_core/tests/merci_base.test, line 650
- Defines abstract base test class for the Merci module tests.
Class
- MerciBaseTestCase
- Abstract class for Merci testing. All Merci tests should extend this
class.
Code
function fieldUIAddNewField($bundle_path, $initial_edit, $field_edit = array(), $instance_edit = array()) {
$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]'];
$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.');
$this
->drupalPost(NULL, $field_edit, t('Save field settings'));
$this
->assertRaw(t('Updated field %label field settings.', array(
'%label' => $label,
)), 'Redirected to instance and widget settings page.');
$this
->drupalPost(NULL, $instance_edit, t('Save settings'));
$this
->assertRaw(t('Saved %label configuration.', array(
'%label' => $label,
)), 'Redirected to "Manage fields" page.');
$this
->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $label, 'Field was created and appears in the overview page.');
}