protected function BotchaBaseWebTestCase::setFormValues in BOTCHA Spam Prevention 7.3
Same name and namespace in other branches
- 6.2 botcha.test \BotchaBaseWebTestCase::setFormValues()
- 6.3 tests/botcha.simpletest.test \BotchaBaseWebTestCase::setFormValues()
- 7.2 botcha.test \BotchaBaseWebTestCase::setFormValues()
Helper function to generate a default form values array for any form.
8 calls to BotchaBaseWebTestCase::setFormValues()
- BotchaHoneypot2TestCase::setFormValues in tests/
botcha.simpletest.test - Helper function to generate a default form values array for any form.
- BotchaHoneypotTestCase::setFormValues in tests/
botcha.simpletest.test - Helper function to generate a default form values array for any form.
- BotchaNoResubmitTestCase::setFormValues in tests/
botcha.simpletest.test - Helper function to generate a default form values array for any form.
- BotchaObscureUrlTestCase::setFormValues in tests/
botcha.simpletest.test - Helper function to generate a default form values array for any form.
- BotchaTestCase::testFormSubmission in tests/
botcha.simpletest.test
5 methods override BotchaBaseWebTestCase::setFormValues()
- BotchaHoneypot2TestCase::setFormValues in tests/
botcha.simpletest.test - Helper function to generate a default form values array for any form.
- BotchaHoneypotTestCase::setFormValues in tests/
botcha.simpletest.test - Helper function to generate a default form values array for any form.
- BotchaNoResubmitTestCase::setFormValues in tests/
botcha.simpletest.test - Helper function to generate a default form values array for any form.
- BotchaObscureUrlTestCase::setFormValues in tests/
botcha.simpletest.test - Helper function to generate a default form values array for any form.
- BotchaTimegateTestCase::setFormValues in tests/
botcha.simpletest.test - Recipe should modify default form to break itself.
File
- tests/
botcha.simpletest.test, line 263 - Simpletest-tests for BOTCHA module.
Class
- BotchaBaseWebTestCase
- Base class for BOTCHA tests.
Code
protected function setFormValues($form, $should_pass = TRUE, &$parameters = array()) {
$edit = array();
switch ($form) {
// These ones for testing FormUI.
case 'addForm':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$edit['botcha_form_id'] = drupal_strtolower($this
->randomName(32));
$parameters['botcha_form_id'] = $edit['botcha_form_id'];
$edit["botcha_form_recipebook"] = $parameters['rbid'];
break;
case 'editForm':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
// Fill in enabled.
$edit['botcha_enabled'] = $parameters['botcha_enabled'];
// Fill in recipe book.
$edit["botcha_form_recipebook"] = $parameters['rbid'];
break;
case 'deleteForm':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
// Nothing to do.
break;
// These ones for testing RecipebookUI.
case 'addRecipebook':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$edit['id'] = drupal_strtolower($this
->randomName(32));
$edit['title'] = $this
->randomName(32);
$edit['description'] = $this
->randomName(255);
$edit['recipes[timegate]'] = 'timegate';
break;
case 'editRecipebook':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$edit['title'] = $this
->randomName(32);
$edit['description'] = $this
->randomName(255);
$edit['recipes[timegate]'] = 'timegate';
break;
case 'deleteRecipebook':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
// @todo BotchaBaseWebTestCase setFormValues Case deleteRecipebook real logic.
break;
// And these ones for testing form submission.
case 'node':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$edit = $this
->setNodeFormValues($should_pass);
break;
case 'user_login':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$edit = $this
->setUserLoginFormValues($should_pass);
break;
case 'comment':
default:
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$edit = $this
->setCommentFormValues($should_pass);
break;
}
return $edit;
}