Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Follow up #1894934: Update CMF Routing component
Comment | File | Size | Author |
---|---|---|---|
#14 | 2099239-accesssubscriber-test-14.patch | 5.55 KB | capuleto |
#10 | 2099239-accesssubscriber-test-8.patch | 5.77 KB | capuleto |
#7 | 2099239-accesssubscriber-test-7.patch | 5.13 KB | capuleto |
#6 | 2099239-accesssubscriber-test-6.patch | 5.12 KB | capuleto |
#5 | 2099239-accesssubscriber-test-5.patch | 5.08 KB | capuleto |
Comments
Comment #1
capuleto CreditAttribution: capuleto commentedComment #2
capuleto CreditAttribution: capuleto commentedComment #3
dawehnerSome people follow the phpunit tag, so you potentially get more reviews on that. Thank you for writing a unit test.
Let's document the proper namespace.
Let's order them properly ...
Let's also add a @group Drupal so you can run just all the drupal tests. In addition it would be nice to have a @see to the actual class, just for convenience.
If you name it like AccessSubscriberTest PhpStorm makes it really easy to switch between the class and the implementation. It is also sort of standard to name the testclass like that.
For the sake of autocompletion it would be great to document all these with the mocked class and the actual mock class (so for example @var \Symfony\Component\HttpKernel\GetResponseEvent|PHPUnit_Framework_MockObject_MockObject
Some single line describing what is tested here would be nice. PS: I really like that you actually split up the tests as much as possible!
Comment #4
capuleto CreditAttribution: capuleto commentedHej dawehner, thank you for your feedback.
Regarding your comments.. I really don't know what do you mean with "Let's document the proper namespace.".
I have checked other unit tests and I cannot really see the difference..
Comment #5
capuleto CreditAttribution: capuleto commentedFixed typo in file header.
Comment #6
capuleto CreditAttribution: capuleto commentedFixed coding standards.
Comment #7
capuleto CreditAttribution: capuleto commentedAdded missing newline after the second last bracket.
Comment #8
dawehnerPerfect!
Comment #9
webchickAwesome work! Thanks for the tests. One hopefully quick thing to fix:
This doc is just a restatement of what the method name is... while that's true of the method above it as well, that one's easier to parse out what it's actually doing.
Could we get a quick line of english here that explains what this test is testing? Is it something like "Tests that if access is granted, no further access checks are done"?
Comment #10
capuleto CreditAttribution: capuleto commentedComment #11
capuleto CreditAttribution: capuleto commentedRefactored test to cover changes introduced by #2048223: Add $account argument to AccessCheckInterface::access() method and use the current_user service and updated docblocks.
Comment #12
capuleto CreditAttribution: capuleto commentedComment #13
dawehnerYou don't have to check explicit that an exception is thrown. If you have an uncatched exception
phpunit will complain.
Comment #14
capuleto CreditAttribution: capuleto commentedComment #15
capuleto CreditAttribution: capuleto commentedOk.. Removed explicit check..
Comment #16
dawehnerTry to always provide an interdiff: https://drupal.org/documentation/git/interdiff
This makes it easier for other people to follow your changes.
Comment #17
capuleto CreditAttribution: capuleto commentedI'll keep that in mind and thank you for the tip.
Comment #18
dawehnerLet's git it in now.
Comment #19
Xano14: 2099239-accesssubscriber-test-14.patch queued for re-testing.
Comment #20
webchickCommitted and pushed to 8.x. Thanks!