Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Aug 2014 at 03:43 UTC
Updated:
4 Dec 2014 at 09:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tim.plunkettComment #2
dawehnerk
Comment #3
dawehnerPlease ensure that this is covered in the phpunit standard issue!
Comment #4
tstoecklerSorry, but I think because we require parens with @see it would be more consistent to require them here as well. Let's at least get some more input on this.
Comment #5
jhodgdonCoding standards changes are now part of the TWG
Comment #6
tim.plunkettNope. PHPUnit defines its coding standard, not us.
Comment #8
tim.plunkettRerolled.
Comment #9
tstoecklerNope. #6 is incorrect (we also don't follow symphony cs) and also no reference has been linked here.
Comment #10
tim.plunkettLink is in the IS. We don't use Symfony's CS because it conflicts with ours. We have no standard for @covers, therefore we should follow PHPUnit.
You may think its a good idea to deviate from that for no particular reason, but I disagree.
Comment #11
tstoecklerOK, so the link in the IS is not really a coding standard per sé, but sure, if all the examples follow a certain pattern that can be considered a standard. You're right that if there is no reason not to, then following the standard is a good thing. I still think that consistency with @see would be one reason not to, but surely weighing the two is a matter of personal opinion.
That said, and in case I didn't make that clear above, I have absolutely no problem with this patch going in as is, I just don't see any reason to rush this at all and I don't think there is something that can be called a consensus here.
So how about we just leave this at "needs review" and see what some other folks think about this?
Comment #12
mile23I would RTBC this if it applied.
It would require heroic effort to re-roll, given the number of piecemeal @covers changes.
PHPUnit conventions are plenty fine for Drupal.
Comment #13
mile23Here's a re-roll.
There are still scads of () out there, which you can find with this regex:
@covers ::\w+\(I'll poke at them over the next few days.
Comment #15
mile23Removed ExternalUrlTest.php since it was removed in #2343759: Provide an API function to replace url()/l() for external urls.
Previous patch adds out-of-scope stuff to settings and services files, possibly due to poor re-roll. Fixed.
Previos patch adds testFieldSqlSchemaForEntityWithStringIdentifier() back, definitely due to poor re-roll. :-) Fixed.
I think I'll leave this patch for whoever wants to RTBC. Other () fixes will be in related patches.
Comment #16
yesct commentednote there are some fixes (not just paren removal)
So reviewers may find applying the patch and using git diff --color-words helpful in spotting those.
---
@Mile23
Please link those issues, so we know where other () removals will be done.
---
Also, since this is a normal task, we should update the summary with an "Allowed in beta?" section,
with info from https://www.drupal.org/core/beta-changes
Comment #17
yesct commentedwhy are we adding getSchema here?
A separate issue for that seems reasonable.
Similar for addFieldSchema
we should fix these here... if there is not a separate issue fixing the @cover -> @covers (or even if there is... it should be easy to reroll for this)
I dont think we should fix the one line summary coding standards thing in this issue. Especially, since we may not do that for phpunit tests.
setDirection is no longer a method.
Comment #18
yesct commentedtaking out the
- * @covers ::getControllerClass
+ * @covers ::getController
change.
I think that makes these changes only in scope now.
Comment #19
mile23Adding beta phase evaluation stuff.
Comment #20
yesct commentedoops. files...
Comment #21
yesct commentedregarding #17 1.
#2358657: Wrong @covers definitions in Drupal project took out the getSchema and addFieldSchema, so we should not add them back in. I think it was just an artifact of the reroll.
Comment #22
yesct commentedand #2300131: EntityResolverManager instantiates objects unnecessarily renamed getController to getControllerClass, so let's leave it getControllerClass in the covers also. ;)
So I dont think we need any separate issues.
Comment #23
mile23Yes, there were far fewer than I thought. I guess I should have done the search on the *patched* version eh?
Anyway, here's the new hotness, removing all the other parentheses I could find, which passes
./vendor/bin/phpunit --strict --coverage-html. This strict coverage mode complains about erroneous@covers, so I think we're good.Updated #2057905: [policy, no patch] Discuss the standards for phpunit based tests with info about not using parentheses.
Comment #24
yesct commentedreviewed that. looks super good to me, but I think I did too much to rtbc it.
Comment #25
jhodgdonI went through this patch carefully with color-words and have verified that the only changes are @cover -> @covers and removing () at the end of those lines. This is good to go. Soon so it does not need reroll.
Comment #26
geerlingguy commentedTested with
--strict --coverage-text, and it works great (1 fail, but that's due to #2373549: PHPUnit test testGetDoesntHitConsistentBackend failing when run with coverage reporting, which has an RTBC patch :). I like following PHPUnit's conventions here, and agree with IS.Comment #27
alexpottComment #28
mile23Rebase of #23.
Comment #29
jibranBack to RTBC.
Comment #30
alexpottThis issue is a unfrozen change (documenation and tests) as per https://www.drupal.org/core/beta-changes. Committed 1a73d7e and pushed to 8.0.x. Thanks!