Exemplo n.º 1
0
 /**
  * @covers ::setErrorByName
  *
  * @dataProvider providerTestSetErrorByName
  */
 public function testSetErrorByName($limit_validation_errors, $expected_errors)
 {
     $form_state = new FormState();
     $form_state->setLimitValidationErrors($limit_validation_errors);
     $form_state->clearErrors();
     $form_state->setErrorByName('test', 'Fail 1');
     $form_state->setErrorByName('test', 'Fail 2');
     $form_state->setErrorByName('options');
     $this->assertSame(!empty($expected_errors), $form_state::hasAnyErrors());
     $this->assertSame($expected_errors, $form_state->getErrors());
 }