Symfony-docs: "How to Unit Test your Forms" page needs improvement

Created on 3 Jan 2018  路  3Comments  路  Source: symfony/symfony-docs

The title of this page suggests that we explain how to do a unit test for a form while the given example is not a unit test. A real unit test should only contain one SUT (Subject Under Test) and everything else should be a mock.

Form Testing hasPR

Most helpful comment

Just asking: does it make any sense at all to unit test a Symfony Form? The basic internal working of the form is guaranteed to work (because we test it in Symfony repo) so shouldn't you just test forms in functional or integration tests only?

All 3 comments

Also, commented by @wouterj in #8971:

It's quite complex if you don't understand forms well and I think it's not a good example of writing tests (and btw, it's not a Unit test at all if written like this)

Just asking: does it make any sense at all to unit test a Symfony Form? The basic internal working of the form is guaranteed to work (because we test it in Symfony repo) so shouldn't you just test forms in functional or integration tests only?

just test forms in functional or integration tests only

Totally agree

Was this page helpful?
0 / 5 - 0 ratings