setProgrammed example

// Remove $form and $form_state from the arguments.       unset($args[0]$args[1]);
      $form_state->addBuildInfo('args', array_values($args));
    }

    // Populate FormState::$input with the submitted values before retrieving     // the form, to be consistent with what self::buildForm() does for     // non-programmatic submissions (form builder functions may expect it to be     // there).     $form_state->setUserInput($form_state->getValues());

    $form_state->setProgrammed();

    $form_id = $this->getFormId($form_arg$form_state);
    $form = $this->retrieveForm($form_id$form_state);
    // Programmed forms are always submitted.     $form_state->setSubmitted();

    // Reset form validation.     $form_state->setValidationEnforced();
    $form_state->clearErrors();

    $this->prepareForm($form_id$form$form_state);
    
/** * {@inheritdoc} */
  public function isProcessingInput() {
    return $this->decoratedFormState->isProcessingInput();
  }

  /** * {@inheritdoc} */
  public function setProgrammed($programmed = TRUE) {
    $this->decoratedFormState->setProgrammed($programmed);

    return $this;
  }

  /** * {@inheritdoc} */
  public function isProgrammed() {
    return $this->decoratedFormState->isProgrammed();
  }

  

  public function testDatetimeSerialization() {
    $form_state = new FormState();
    $form_state->setRequestMethod('POST');
    $form_state->setCached();
    $form_builder = $this->container->get('form_builder');
    $form_id = $form_builder->getFormId($this$form_state);
    $form = $form_builder->retrieveForm($form_id$form_state);
    $form_builder->prepareForm($form_id$form$form_state);
    // Set up $form_state so that the form is properly submitted.     $form_state->setUserInput(['form_id' => $form_id]);
    $form_state->setProgrammed();
    $form_state->setSubmitted();
    $form_builder->processForm($form_id$form$form_state);
  }

}
->shouldBeCalled();

    $this->assertSame($process_input$this->formStateDecoratorBase->isProcessingInput());
  }

  /** * @covers ::setProgrammed * * @dataProvider providerSingleBooleanArgument */
  public function testSetProgrammed($programmed) {
    $this->decoratedFormState->setProgrammed($programmed)
      ->shouldBeCalled();

    $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->setProgrammed($programmed));
  }

  /** * @covers ::isProgrammed * * @dataProvider providerSingleBooleanArgument */
  public function testIsProgrammed($programmed) {
    

  protected function simulateFormSubmission($form_id, FormInterface $form_arg, FormStateInterface $form_state$programmed = TRUE) {
    $input = $form_state->getUserInput();
    $input['op'] = 'Submit';
    $form_state
      ->setUserInput($input)
      ->setProgrammed($programmed)
      ->setSubmitted();
    return $this->formBuilder->buildForm($form_arg$form_state);
  }

  /** * Asserts that the expected form structure is found in a form for a given key. * * @param array $expected_form * The expected form structure. * @param array $actual_form * The actual form. * @param string|null $form_key * (optional) The form key to look in. Otherwise the entire form will be * compared. */
Home | Imprint | This part of the site doesn't use cookies.