Пример #1
0
 /**
  * Tests that setting the value for an element adds to the values.
  *
  * @covers ::setValueForElement
  */
 public function testSetValueForElement()
 {
     $element = array('#parents' => array('foo', 'bar'));
     $value = $this->randomMachineName();
     $form_state = new FormState();
     $form_state->setValueForElement($element, $value);
     $expected = array('foo' => array('bar' => $value));
     $this->assertSame($expected, $form_state->getValues());
 }
Пример #2
0
 /**
  * @covers ::setValues
  * @covers ::getValues
  */
 public function testGetValues()
 {
     $values = ['foo' => 'bar'];
     $form_state = new FormState();
     $form_state->setValues($values);
     $this->assertSame($values, $form_state->getValues());
 }