protected function BotchaBaseWebTestCase::getCommentFormValuesFromForm in BOTCHA Spam Prevention 7.2
Same name and namespace in other branches
- 6 botcha.test \BotchaBaseWebTestCase::getCommentFormValuesFromForm()
- 6.2 botcha.test \BotchaBaseWebTestCase::getCommentFormValuesFromForm()
- 6.3 tests/botcha.simpletest.test \BotchaBaseWebTestCase::getCommentFormValuesFromForm()
- 7 botcha.test \BotchaBaseWebTestCase::getCommentFormValuesFromForm()
- 7.3 tests/botcha.simpletest.test \BotchaBaseWebTestCase::getCommentFormValuesFromForm()
Helper function to get form values array from comment form
File
- ./
botcha.test, line 147 - Tests for BOTCHA module.
Class
- BotchaBaseWebTestCase
- Base class for BOTCHA tests.
Code
protected function getCommentFormValuesFromForm() {
// Submit the form using the displayed values.
$langcode = LANGUAGE_NONE;
$displayed = array();
foreach (array(
'subject' => "//input[@id='edit-subject']/@value",
"comment_body[{$langcode}][0][value]" => "//textarea[@id='edit-comment-body-{$langcode}-0-value']",
'botcha_response' => "//input[@id='edit-botcha-response']/@value",
) as $field => $path) {
$value = current($this
->xpath($path));
if (!empty($value)) {
$displayed[$field] = (string) $value;
}
}
return $displayed;
}