FormStateValuesTraitStub example


  public function testSetValueForElement() {
    $element = [
      '#parents' => [
        'foo',
        'bar',
      ],
    ];
    $value = $this->randomMachineName();

    $form_state = new FormStateValuesTraitStub();
    $form_state->setValueForElement($element$value);
    $expected = [
      'foo' => [
        'bar' => $value,
      ],
    ];
    $this->assertSame($expected$form_state->getValues());
  }

  /** * @covers ::getValue * * @dataProvider providerGetValue */
Home | Imprint | This part of the site doesn't use cookies.