protected function BotchaBaseWebTestCase::getCommentFormValuesFromForm in BOTCHA Spam Prevention 7.3
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.2 botcha.test \BotchaBaseWebTestCase::getCommentFormValuesFromForm()
Helper function to get form values array from comment form
File
- tests/
botcha.simpletest.test, line 139 - Simpletest-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",
// @todo Abstract it.
//'comment' => "//textarea[@id='edit-comment-body-$langcode-0-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;
}