Problem/Motivation
AjaxCommandsTest needs a general cleanup of coverage annotation.
The following problems exist:
- Incorrect coverage annotation.
- Mocking of nonexistent methods, with no expectations for those methods.
- PHPUnit coding standards issues, mainly docblock summary lines. The documentation for the phpunit based test can be found in #2057905: [policy, no patch] Discuss the standards for phpunit based tests.
Proposed resolution
- Individual methods of AjaxCommandsTest test different classes, so they should be annotated as covering that class.
- Change method mocks to reflect existing methods.
- Set method mock expectations, so they will fail if the implementations change.
- Remove docblock one-line summaries.
Remaining tasks
User interface changes
API changes
Original report by @daffie
Beta phase evaluation
| Unfrozen changes | Unfrozen because it only improves automated testing and coverage accuracy. |
|---|
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | interdiff.txt | 14.08 KB | mile23 |
| #8 | 2409655_8.patch | 15.04 KB | mile23 |
Comments
Comment #1
daffie commentedComment #2
Cogax commentedComment #3
Cogax commentedComment #4
zealfire commentedComment #5
zealfire commentedSubmitting a patch after reading the docs.Please review.
Thanks.
Comment #6
daffie commentedThe tricky part of this issue is that we are testing a group of classes and not one class with a number of methods.
We are not testing one class. So this change does not apply.
We are covering a whole class not just one method. So lets change this to "@covers \Drupal\Core\Ajax\AddCssCommand". The same for all the other @covers.
Comment #7
mile23+1 on #6.
Comment #8
mile23I did the following to AjaxCommandsTest:
testOpenDialogCommand()andtestOpenModalDialogCommand(). They were mocking a method which doesn't exist any more, without any expectations or return value.Room for improvement:
testOpenDialogCommand()andtestOpenModalDialogCommand().Comment #9
mile23Comment #10
daffie commentedIt all looks good to me.
It is about tests and documentation so it is allowed for beta-changes.
It is for me RTBC.
Good work @Mile23.
Comment #11
alexpottCan the issue title and summary be updated to reflect the current scope of the patch. Thanks.
Comment #12
mile23Better?
Comment #13
mile23Comment #14
alexpottCommitted 226f002 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.