1 form.test FormsFormStorageTestCase::testFormCached()

Tests using the form with an activated $form_state['cache'] property.

File

core/modules/simpletest/tests/form.test, line 1293
Unit tests for the Backdrop Form API.

Class

FormsFormStorageTestCase
Test the form storage on a multistep form.

Code

function testFormCached() {
  $this->backdropGet('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->backdropPost(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->backdropPost(NULL, array('title' => 'changed'), 'Reset');
  $this->assertFieldByName('title', 'new', 'Values have been reset.');
  $this->assertText('Form constructions: 3');

  $this->backdropPost(NULL, $edit, 'Save');
  $this->assertText('Form constructions: 3');
  $this->assertText('Title: new', 'The form storage has stored the values.');
}