function BotchaBaseWebTestCase::postForm in BOTCHA Spam Prevention 7.3
Same name and namespace in other branches
- 6.2 botcha.test \BotchaBaseWebTestCase::postForm()
- 6.3 tests/botcha.simpletest.test \BotchaBaseWebTestCase::postForm()
- 7.2 botcha.test \BotchaBaseWebTestCase::postForm()
Post one of predefined forms. Used to unify the process of testing.
4 calls to BotchaBaseWebTestCase::postForm()
- BotchaNoResubmitTestCase::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 - BotchaTestFormUI::testFormUI in tests/
botcha.simpletest.test - Tests for creating, modifying and deleting botcha forms.
- BotchaTestRecipebookUI::testRecipebookUI in tests/
botcha.simpletest.test - Tests for creating, modifying and deleting recipe books.
File
- tests/
botcha.simpletest.test, line 462 - Simpletest-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', 0);
variable_set('comment_preview_page', DRUPAL_OPTIONAL);
$button = $button ? $button : t('Save');
$this
->drupalPost(NULL, $edit, $button);
break;
}
}