function BotchaBaseWebTestCase::postForm in BOTCHA Spam Prevention 6.2
Same name and namespace in other branches
- 6.3 tests/botcha.simpletest.test \BotchaBaseWebTestCase::postForm()
- 7.2 botcha.test \BotchaBaseWebTestCase::postForm()
- 7.3 tests/botcha.simpletest.test \BotchaBaseWebTestCase::postForm()
Post one of predefined forms. Used to unify the process of testing.
2 calls to BotchaBaseWebTestCase::postForm()
- BotchaNoResubmitTestCase::setFormValues in ./
botcha.test - Helper function to generate a default form values array for any form.
- BotchaTestCase::testFormSubmission in ./
botcha.test
File
- ./
botcha.test, line 457 - Tests for BOTCHA module.
Class
- BotchaBaseWebTestCase
- Base class for BOTCHA tests.
Code
function postForm($form, $edit, $button = NULL, &$parameters = array()) {
switch ($form) {
// These ones for testing Form UI.
case 'addForm':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$button = $button ? $button : t('Add');
$this
->drupalPost(NULL, $edit, $button);
break;
case 'editForm':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$button = $button ? $button : t('Save');
$this
->drupalPost(NULL, $edit, $button);
break;
case 'deleteForm':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$button = $button ? $button : t('Delete');
$this
->drupalPost(NULL, $edit, $button);
break;
// These ones for testing Recipebook UI.
case 'addRecipebook':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$button = $button ? $button : t('Add');
$this
->drupalPost(NULL, $edit, $button);
break;
case 'editRecipebook':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$button = $button ? $button : t('Save');
$this
->drupalPost(NULL, $edit, $button);
break;
case 'deleteRecipebook':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
// @todo Case deleteRecipebook.
break;
// And these ones are for testing form submissions.
case 'node':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$button = $button ? $button : t('Save');
$this
->drupalPost(NULL, $edit, $button);
break;
case 'user_login':
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
$button = $button ? $button : t('Log in');
$this
->drupalPost(NULL, $edit, $button);
break;
case 'comment':
default:
$this
->debug("Entered %method %case", array(
'%method' => __METHOD__,
'%case' => $form,
));
// Make sure comments on pages can be saved directly without preview.
// @todo Abstract it.
//variable_set('comment_preview_page', DRUPAL_OPTIONAL);
variable_set('comment_preview_page', 0);
$button = $button ? $button : t('Save');
$this
->drupalPost(NULL, $edit, $button);
break;
}
}