public function BotchaTestCase::testFormSubmission in BOTCHA Spam Prevention 6.3
Same name and namespace in other branches
- 6.2 botcha.test \BotchaTestCase::testFormSubmission()
- 7.2 botcha.test \BotchaTestCase::testFormSubmission()
- 7.3 tests/botcha.simpletest.test \BotchaTestCase::testFormSubmission()
File
- tests/
botcha.simpletest.test, line 1016 - Simpletest-tests for BOTCHA module.
Class
- BotchaTestCase
- Testing general BOTCHA functionality.
Code
public function testFormSubmission() {
$forms = array(
'comment',
);
foreach ($forms as $form) {
// Determine what we expect: whether successful submission or blocked or both.
foreach ($this
->getExpectations() as $should_pass) {
foreach ($this
->getButtonsByForm($form) as $button) {
// Check some assumptions that are necessary for this test.
$this
->checkPreConditions($form, $should_pass, $button);
// Get a form.
$this
->getForm($form);
// Fill in the form.
$edit = $this
->setFormValues($form, $should_pass);
// Submit the form.
$this
->postForm($form, $edit, $button);
// Make sure that we get what expected.
$this
->assertFormSubmission($form, $edit, $should_pass, $button);
}
}
}
}