You are here

function FormsArbitraryRebuildTestCase::testUserRegistrationRebuild in Drupal 7

Tests a basic rebuild with the user registration form.

File

modules/simpletest/tests/form.test, line 2034
Unit tests for the Drupal Form API.

Class

FormsArbitraryRebuildTestCase
Tests rebuilding of arbitrary forms by altering them.

Code

function testUserRegistrationRebuild() {
  $edit = array(
    'name' => 'foo',
    'mail' => 'bar@example.com',
  );
  $this
    ->drupalPost('user/register', $edit, 'Rebuild');
  $this
    ->assertText('Form rebuilt.');
  $this
    ->assertFieldByName('name', 'foo', 'Entered user name has been kept.');
  $this
    ->assertFieldByName('mail', 'bar@example.com', 'Entered mail address has been kept.');
}