function FormsFormStorageTestCase::testForm
Tests using the form in a usual way.
File
-
modules/
simpletest/ tests/ form.test, line 1149
Class
- FormsFormStorageTestCase
- Test the form storage on a multistep form.
Code
function testForm() {
$this->drupalGet('form_test/form-storage');
$this->assertText('Form constructions: 1');
$edit = array(
'title' => 'new',
'value' => 'value_is_set',
);
// Use form rebuilding triggered by a submit button.
$this->drupalPost(NULL, $edit, 'Continue submit');
$this->assertText('Form constructions: 2');
$this->assertText('Form constructions: 3');
// Reset the form to the values of the storage, using a form rebuild
// triggered by button of type button.
$this->drupalPost(NULL, array(
'title' => 'changed',
), 'Reset');
$this->assertFieldByName('title', 'new', 'Values have been resetted.');
// After rebuilding, the form has been cached.
$this->assertText('Form constructions: 4');
$this->drupalPost(NULL, $edit, 'Save');
$this->assertText('Form constructions: 4');
$this->assertText('Title: new', 'The form storage has stored the values.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.