You are here

public function ConfigFormTest::testValidateForm in Flysystem 3.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::testValidateForm()
  2. 3.x tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::testValidateForm()
  3. 2.0.x tests/src/Unit/Form/ConfigFormTest.php \Drupal\Tests\flysystem\Unit\Form\ConfigFormTest::testValidateForm()

@covers ::validateForm

File

tests/src/Unit/Form/ConfigFormTest.php, line 98

Class

ConfigFormTest
@coversDefaultClass \Drupal\flysystem\Form\ConfigForm @group flysystem

Namespace

Drupal\Tests\flysystem\Unit\Form

Code

public function testValidateForm() {
  $form_state = new FormState();
  $form = $this->form
    ->buildForm([], $form_state);
  $form['sync_from']['#parents'] = [
    'sync_from',
  ];
  $form['sync_to']['#parents'] = [
    'sync_to',
  ];
  $form_state
    ->setValue('sync_from', 'from');
  $form_state
    ->setValue('sync_to', 'to');
  $this->form
    ->validateForm($form, $form_state);
  $this
    ->assertSame(0, count($form_state
    ->getErrors()));
  $form_state
    ->setValue('sync_to', 'from');
  $this->form
    ->validateForm($form, $form_state);
  $this
    ->assertSame(2, count($form_state
    ->getErrors()));
}