public function BotchaTestFormUI::testFormUI in BOTCHA Spam Prevention 6.3
Same name and namespace in other branches
- 7.3 tests/botcha.simpletest.test \BotchaTestFormUI::testFormUI()
Tests for creating, modifying and deleting botcha forms.
File
- tests/
botcha.simpletest.test, line 928 - Simpletest-tests for BOTCHA module.
Class
Code
public function testFormUI() {
// Create a recipe book.
$recipebook_controller = $this->application
->getController(Botcha::CONTROLLER_TYPE_RECIPEBOOK);
$id = 'test';
$title = 'FormUI recipe book';
$description = 'Created for testing FormUI';
$recipebook = $recipebook_controller
->getRecipebook($id)
->setTitle($title)
->setDescription($description);
$recipebook_controller
->save($recipebook);
$forms = array(
'addForm',
'editForm',
'deleteForm',
);
// Parameters that need to be passed through methods.
$parameters = array();
$parameters['rbid'] = $id;
foreach ($forms as $form) {
$this
->getForm($form, $parameters);
$edit = $this
->setFormValues($form, NULL, $parameters);
$this
->postForm($form, $edit, NULL, $parameters);
$this
->assertFormSubmission($form, $edit, NULL, NULL, $parameters);
}
}