Skip to content

Fix form unit testing code sample #13744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions form/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ The simplest ``TypeTestCase`` implementation looks like the following::
'test2' => 'test2',
];

$formData = new TestObject();
$model = new TestObject();
// $formData will retrieve data from the form submission; pass it as the second argument
$form = $this->factory->create(TestedType::class, $formData);
$form = $this->factory->create(TestedType::class, $model);

$expected = new TestObject();
// ...populate $object properties with the data stored in $formData
Expand All @@ -68,7 +68,7 @@ The simplest ``TypeTestCase`` implementation looks like the following::
$this->assertTrue($form->isSynchronized());

// check that $formData was modified as expected when the form was submitted
$this->assertEquals($expected, $formData);
$this->assertEquals($expected, $model);
}

public function testCustomFormView()
Expand Down