You are here

public function ArbitraryRebuildTest::testUserRegistrationMultipleField in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php \Drupal\Tests\system\Functional\Form\ArbitraryRebuildTest::testUserRegistrationMultipleField()

Tests a rebuild caused by a multiple value field.

File

core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php, line 71

Class

ArbitraryRebuildTest
Tests altering forms to be rebuilt so there are multiple steps.

Namespace

Drupal\Tests\system\Functional\Form

Code

public function testUserRegistrationMultipleField() {
  $edit = [
    'name' => 'foo',
    'mail' => 'bar@example.com',
  ];
  $this
    ->drupalPostForm('user/register', $edit, t('Add another item'));
  $this
    ->assertText('Test a multiple valued field', 'Form has been rebuilt.');
  $this
    ->assertFieldByName('name', 'foo', 'Entered username has been kept.');
  $this
    ->assertFieldByName('mail', 'bar@example.com', 'Entered mail address has been kept.');
}