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.
The Drupal\Tests\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecoratorTest misses a @covers and a @coversDefaultClass documentation.
The documentation for the phpunit based test can be found in #2057905: [policy, no patch] Discuss the standards for phpunit based tests.
Comment | File | Size | Author |
---|---|---|---|
#5 | interdiff-2409647-2-5.txt | 929 bytes | zealfire |
#5 | revised-container-derivative-discovery-test-2409647-5.patch | 945 bytes | zealfire |
#2 | revised-container-derivative-discovery-test-2409647-2.patch | 1.03 KB | zealfire |
Comments
Comment #1
daffie CreditAttribution: daffie commentedComment #2
zealfire CreditAttribution: zealfire commentedI have tried to make a patch after reading the docs of @covers but not sure.Please review.
Thanks
Comment #3
daffie CreditAttribution: daffie commentedSo that the testbot runs.
Comment #4
daffie CreditAttribution: daffie commentedThese lines can be removed. The lines that you add say the same. :-)
Comment #5
zealfire CreditAttribution: zealfire commentedImplemented the missed things in new patch .Please review.
Thanks.
Comment #6
daffie CreditAttribution: daffie commentedGood work zealfire.
It all looks good to me.
It is all documentation, so it is allowed. See beta-changes.
Comment #7
alexpottCommitted 369771b and pushed to 8.0.x. Thanks!
Comment #9
Mile23There's no such thing as
ContainerDerivativeDiscoveryDecorator::getDerivativeFetcher()
, so this test cannot cover it. Trying to generate a coverage report results in an error.If the testbot were to generate a coverage report automatically, this sort of error would not happen, either in the first place or in subsequent fixes.
Looking at the code of the test, we see that it asserts against the result of ContainerDerivativeDiscoveryDecorator::getDefinitions(), which would (erroneously) suggest that a proper
@covers
annotation might be forgetDefinitions()
.However,
ContainerDerivativeDiscoveryDecorator
doesn't actually implementgetDefinitions()
(its parent does), so if this test is trying to cover any of ContainerDerivativeDiscoveryDecorator's methods, it's either a poor test, or uses side-effects in some way not clear from the test.In fact,
ContainerDerivativeDiscoveryDecorator
only has one method:getDeriver()
, which doesn't appear to have any coverage at all. I can't tell for sure because I'm unable to generate a coverage report because of this error. :-)So, next steps:
ContainerDerivativeDiscoveryDecorator::getDeriver()
, probably in another issue.Comment #10
cilefen CreditAttribution: cilefen commentedThe further tasks are not novice.
Comment #12
Mile23Added #2620330: Move ContainerDerivativeDiscoveryDecoratorTest::testGetDefinitions() to DerivativeDiscoveryDecoratorTest.
Re-closing this issue.