use hydrator variable only when hydrator variable is assigned
added testcase and reverted changes and prevent the php notice
#6949 - explicit `setExpectedException` usage
#6949 - adding missing `@group` annotation for newly introduced tests in this PR
#6949 - minor CS fixes (spacing)
Merge branch 'hotfix/#6949-form-factory-undefined-hydrator'

Close #6949