Skip to content

Commit

Permalink
minor #5043 Switched the first example to a static constructor method…
Browse files Browse the repository at this point in the history
… (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
  • Loading branch information
weaverryan committed Mar 14, 2015
2 parents ce19196 + 118513b commit 9b1f5f1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions cookbook/form/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ The simplest ``TypeTestCase`` implementation looks like the following::
$type = new TestedType();
$form = $this->factory->create($type);

$object = new TestObject();
$object->fromArray($formData);
$object = TestObject::fromArray($formData);

// submit the data to the form directly
$form->submit($formData);
Expand Down

0 comments on commit 9b1f5f1

Please sign in to comment.