private function GeshiFieldTest::addField in GeSHi Filter for syntax highlighting 8
Same name and namespace in other branches
- 8.2 geshifield/tests/src/Functional/GeshiFieldTest.php \Drupal\Tests\geshifield\Functional\GeshiFieldTest::addField()
Add a field.
Parameters
string $type: The type of field.
string $name: The name of the field.
string $label: The label of the field.
array $values: Possible values of the field.
array $instance: Instance of the field.
1 call to GeshiFieldTest::addField()
- GeshiFieldTest::testAddField in geshifield/
tests/ src/ Functional/ GeshiFieldTest.php - Test if we can add the field and a node on it.
File
- geshifield/
tests/ src/ Functional/ GeshiFieldTest.php, line 155
Class
- GeshiFieldTest
- Tests for GeshiField in node content.
Namespace
Drupal\Tests\geshifield\FunctionalCode
private function addField($type, $name, $label, array $values = [], array $instance = []) {
// Choose field type and name.
$edit = [];
$edit['new_storage_type'] = $type;
$edit['label'] = $label;
$edit['field_name'] = $name;
$this
->drupalPostForm('admin/structure/types/manage/geshifilter_content_type/fields/add-field', $edit, 'Save and continue');
// Number of values in field, keep the default, 1.
$this
->drupalPostForm(NULL, $values, 'Save field settings');
// Settings for this instance of field, keep the default.
$this
->drupalPostForm(NULL, $instance, 'Save settings');
}