public function testGetSchemaStateWithFormValidation() { $field = new FormField('MyField', 'My Field'); $validator = new RequiredFields('MyField'); $form = new Form(new Controller(), 'TestForm', new FieldList($field), new FieldList(), $validator); $form->validate(); $form->setupFormErrors(); $schema = $field->getSchemaState(); $this->assertEquals(['html' => '"My Field" is required'], $schema['message']['value']); }