You are here

function FormsFormStorageTestCase::testFormCached in SimpleTest 7

Tests using the form with an activated #cache property.

File

tests/form.test, line 415
Unit tests for the Drupal Form API.

Class

FormsFormStorageTestCase
Test the form storage on a multistep form.

Code

function testFormCached() {
  $user = $this
    ->drupalCreateUser(array(
    'access content',
  ));
  $this
    ->drupalLogin($user);
  $this
    ->drupalPost('form_test/form-storage', array(
    'title' => 'new',
    'value' => 'value_is_set',
  ), 'Continue', array(
    'query' => array(
      'cache' => 1,
    ),
  ));
  $this
    ->assertText('Form constructions: 1', t('The form has been constructed one time till now.'));
  $this
    ->drupalPost(NULL, array(), 'Save', array(
    'query' => array(
      'cache' => 1,
    ),
  ));
  $this
    ->assertText('Form constructions: 2', t('The form has been constructed two times till now.'));
  $this
    ->assertText('Title: new', t('The form storage has stored the values.'));
}