/** * Tests the setError() method. * * @covers ::setError */ public function testSetError() { $form_state = new FormState(); $element['#parents'] = array('foo', 'bar'); $form_state->setError($element, 'Fail'); $this->assertSame(['foo][bar' => 'Fail'], $form_state->getErrors()); }