public function MultifieldAdministrationTestCase::testMultifield in Multifield 7.2
Same name and namespace in other branches
- 7 tests/MultifieldAdministrationTestCase.test \MultifieldAdministrationTestCase::testMultifield()
File
- tests/
MultifieldAdministrationTestCase.test, line 20
Class
Code
public function testMultifield() {
$type = $this
->drupalCreateContentType();
$edit = array(
'fields[_add_new_field][label]' => 'Test multifield',
'fields[_add_new_field][field_name]' => 'field_multifield_test',
'fields[_add_new_field][type]' => 'multifield',
'fields[_add_new_field][widget_type]' => 'multifield_default',
);
$this
->drupalPost('admin/structure/types/manage/' . $type->type . '/fields', $edit, 'Save');
$this
->assertFieldChecked('edit-field-settings-hide-blank-items');
$this
->drupalPost(NULL, array(), 'Save field settings');
$this
->drupalPost(NULL, array(), 'Save settings');
$elements = $this
->xpath('//tr[@id="field-field-multifield-test" and contains(@class, "warning")]');
$this
->assertTrue(!empty($elements), 'Warning on field row since multifield does not contain subfields.');
$this
->clickLink('Manage Subfields');
$edit = array(
'fields[_add_new_field][label]' => 'Subfield 1',
'fields[_add_new_field][field_name]' => 'field_subfield1',
'fields[_add_new_field][type]' => 'text',
'fields[_add_new_field][widget_type]' => 'text_textfield',
);
$this
->drupalPost(NULL, $edit, 'Save');
$this
->drupalPost(NULL, array(), 'Save field settings');
$this
->drupalPost(NULL, array(), 'Save settings');
$elements = $this
->xpath('//tr[@id="field-field-multifield-test" and contains(@class, "warning")]');
$this
->assertTrue(empty($elements), 'No warning on field row since multifield contains subfields.');
}