Skip to content

Commit 9b1f5f1

Browse files
committed
minor #5043 Switched the first example to a static constructor method (kix)
This PR was submitted for the 2.6 branch but it was merged into the 2.3 branch instead (closes #5043). Discussion ---------- 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). Commits ------- 118513b Switched the first example to a static constructor method
2 parents ce19196 + 118513b commit 9b1f5f1

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)