Skip to content

Commit 118513b

Browse files
kixweaverryan
authored andcommitted
Switched the first example to a static constructor method
I believe having a non-static method for class instantiation is not something the documentation should encourage. It's much better to use a named constructor here (also note that `TestObject` class code isn't supplied).
1 parent ce19196 commit 118513b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cookbook/form/unit_testing.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ The simplest ``TypeTestCase`` implementation looks like the following::
5555
$type = new TestedType();
5656
$form = $this->factory->create($type);
5757

58-
$object = new TestObject();
59-
$object->fromArray($formData);
58+
$object = TestObject::fromArray($formData);
6059

6160
// submit the data to the form directly
6261
$form->submit($formData);

0 commit comments

Comments
 (0)