function FormsFormStorageTestCase::testFormCached in Drupal 7
Tests using the form with an activated $form_state['cache'] property.
File
- modules/
simpletest/ tests/ form.test, line 1174 - Unit tests for the Drupal Form API.
Class
- FormsFormStorageTestCase
- Test the form storage on a multistep form.
Code
function testFormCached() {
$this
->drupalGet('form_test/form-storage', array(
'query' => array(
'cache' => 1,
),
));
$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');
// 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.');
$this
->assertText('Form constructions: 3');
$this
->drupalPost(NULL, $edit, 'Save');
$this
->assertText('Form constructions: 3');
$this
->assertText('Title: new', 'The form storage has stored the values.');
}