Tests adding a new field.
@todo Assert properties can bet set in the form and read back in $field and $instances.
function createField() {
// Create a test field.
$edit = array(
'fields[_add_new_field][label]' => $this->field_label,
'fields[_add_new_field][field_name]' => $this->field_name_input,
);
$this
->fieldUIAddNewField('admin/structure/types/manage/' . $this->type, $edit);
// Assert the field appears in the "re-use existing field" section for
// different entity types; e.g. if a field was added in a node entity, it
// should also appear in the 'taxonomy term' entity.
$vocabulary = taxonomy_vocabulary_load('tags');
$this
->drupalGet('admin/structure/taxonomy/manage/' . $vocabulary
->id() . '/fields');
$this
->assertTrue($this
->xpath('//select[@name="fields[_add_existing_field][field_name]"]//option[@value="' . $this->field_name . '"]'), 'Existing field was found in taxonomy term fields.');
}