-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Provide full test example #4712
Conversation
In my opinion providing the full code for the example only adds a few additional lines, but increases the value of the example greatly. Of course the name for the test should probably be changed as couldn't think of a good one. ping @stof | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.3 | Fixed tickets |
{ | ||
$client = self::createClient(); | ||
$client->request('GET', $url); | ||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should remove the open tag, we never use it in the docs.
Why pinging me here ? |
Mostly because of https://twitter.com/_md/status/545597981270241280 As I don't really like the name of the test |
$this->assertTrue($client->getResponse()->isSuccessful()); | ||
} | ||
|
||
public function provideUrls() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would like to rename this to UrlProvider, this would be consistent with the PHPUnit manual
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this naming is fine (I always use the getPageIsSuccessfulData
convention, but this one is good to understand for beginners too)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally use ...Provider
, makes it clear that this function is being used as a data provider for some test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think both getPageIsSuccessfulData()
and urlProvider()
are fine.
👍 |
array('/archives'), | ||
// ... | ||
); | ||
/** @dataProvider provideUrls */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would actually like to have this as a "real" docblock:
/**
* @dataProvider provideUrls
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, me too.
Will change it after the decision about the provider function name will be made.
{ | ||
$client = self::createClient(); | ||
$client->request('GET', $url); | ||
// src/AppBundle/Tests/ApplicationAvailabilityFunctionalTest.php | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the + // src/AppBundle/Tests/ApplicationAvailabilityFunctionalTest.php
one ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope the empty line after the line you mentioned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
One minor fix away from finished imo. |
I like it. Thanks Andrew! |
This PR was merged into the 2.3 branch. Discussion ---------- Provide full test example In my opinion providing the full code for the example only adds a few additional lines, but increases the value of the example greatly. Of course the name for the test should probably be changed as couldn't think of a good one. ping @stof | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.3 | Fixed tickets | Commits ------- 9832e23 Update tests.rst 4df1fe1 Update tests.rst d4907ca Update tests.rst d4ab971 Provide full test example
In my opinion providing the full code for the example only adds a few additional lines, but increases the value of the example greatly.
Of course the name for the test should probably be changed as couldn't think of a good one. ping @stof