public function testGetStateWithFieldValidationErrors()
 {
     $fields = new FieldList(new TextField('Title'));
     $actions = new FieldList();
     $validator = new RequiredFields('Title');
     $form = new Form(new Controller(), 'TestForm', $fields, $actions, $validator);
     $form->loadDataFrom(['Title' => null]);
     $this->assertFalse($form->validate());
     $formSchema = new FormSchema();
     $expected = ['id' => 'Form_TestForm', 'fields' => [['id' => 'Form_TestForm_Title', 'value' => null, 'message' => ['value' => ['html' => '"Title" is required'], 'type' => 'required'], 'data' => [], 'name' => 'Title'], ['id' => 'Form_TestForm_SecurityID', 'value' => $form->getSecurityToken()->getValue(), 'message' => null, 'data' => [], 'name' => 'SecurityID']], 'valid' => false, 'messages' => []];
     $state = $formSchema->getState($form);
     $this->assertInternalType('array', $state);
     $this->assertJsonStringEqualsJsonString(json_encode($expected), json_encode($state));
 }