protected function CommentAlterAdminTestCase::hasExistingFieldOption in Comment Alter 7
Checks that the field is an option for 'Add existing field'.
You have to use $this->drupalGet() to load the 'Manage fields' page before calling this function.
Parameters
string $field_name: Name of the field to look for.
Return value
boolean Returns TRUE if found; otherwise FALSE.
1 call to CommentAlterAdminTestCase::hasExistingFieldOption()
File
- ./
comment_alter.test, line 248 - Functional tests for the Comment Alter module.
Class
- CommentAlterAdminTestCase
- Functional tests for the admin UIs provided by Comment Alter.
Code
protected function hasExistingFieldOption($field_name) {
$result = $this
->xpath('//select[@id="edit-fields-add-existing-field-field-name"]');
$options = $this
->getAllOptions($result[0]);
foreach ($options as $option) {
if ($option['value'] == $field_name) {
return TRUE;
}
}
return FALSE;
}