Add unit test for magic set method
Fix undefined variable
Merge pull request #5497 from wilsonge/formtest

Add unit test for magic set method