Skip to content

correct PHP code #8013

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
11 changes: 6 additions & 5 deletions form/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ allows you to return a list of extensions to register::
$this->validator
->method('validate')
->will($this->returnValue(new ConstraintViolationList()));
$validator
$this->validator
->method('getMetadataFor')
->will($this->returnValue(new ClassMetadata(Form::class)));

Expand Down Expand Up @@ -227,14 +227,15 @@ a good opportunity to use them::

class TestedTypeTest extends TypeTestCase
{
/**
* @dataProvider getValidTestData
*/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks wrong, as the data provider for the method testForm is the method getValidTestData.

The PHP doc

/**
 * @dataProvider getValidTestData
 */

doesn't mean

this method is a data provider

but instead means

the data provider for this method is this other method

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this part needs to be kept as is. But the other change is great. 👍

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @apfelbox , it is clear that you are right
thanks @xabbuh, I'm happy to correct a Symfony's documentation for the second time 👍

public function testForm($data)
{
// ... your test
}


/**
* @dataProvider getValidTestData
*/
public function getValidTestData()
{
return array(
Expand Down