Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Some of the code in core does not follow the phpunit standards described here
The Task is to change the @covers documentation to fix this. The @covers documentation is used by phpunit test coverage to see how much the test function covers the tested function.
d8/core$ grep -nriI "\* @covers " --exclude-dir=vendor | grep -v " ::*"
modules/path/tests/src/Unit/Field/PathFieldDefinitionTest.php:35: * @covers \Drupal\Core\Field\BaseFieldDefinition::getColumns
modules/path/tests/src/Unit/Field/PathFieldDefinitionTest.php:36: * @covers \Drupal\path\Plugin\Field\FieldType\PathItem::schema
modules/migrate/tests/src/Unit/RowTest.php:182: * @covers \Drupal\migrate\Row::setIdMap
modules/migrate/tests/src/Unit/RowTest.php:183: * @covers \Drupal\migrate\Row::getIdMap
modules/migrate/tests/src/Unit/RowTest.php:207: * @covers \Drupal\migrate\Row::getSourceProperty
tests/Drupal/Tests/Core/Mail/MailManagerTest.php:107: * @covers \Drupal\Core\Mail\MailManager::getInstance
tests/Drupal/Tests/Core/Controller/AjaxRendererTest.php:46: * @covers \Drupal\Core\Render\MainContent\AjaxRenderer::renderResponse
tests/Drupal/Tests/Core/Routing/RouteMatchTest.php:33: * @covers \Drupal\Core\Routing\NullRouteMatch
tests/Drupal/Tests/Core/Routing/AccessAwareRouterTest.php:103: * @covers \Drupal\Core\Routing\AccessAwareRouter::__call
tests/Drupal/Tests/Core/Routing/RouteMatchBaseTest.php:105: * @covers \Drupal\Core\Routing\RouteMatch::getParameterNames
tests/Drupal/Tests/Core/Routing/RouteMatchBaseTest.php:119: * @covers \Drupal\Core\Routing\RouteMatch::getParameterNames
tests/Drupal/Tests/Core/Routing/RouteMatchBaseTest.php:128: * @covers \Drupal\Core\Routing\RouteMatch::getParameterNames
tests/Drupal/Tests/Core/Routing/RouteMatchBaseTest.php:142: * @covers \Drupal\Core\Routing\RouteMatch::getParameterNames
tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php:125: * @covers \Drupal\Core\Menu\LocalActionManager::getTitle
tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php:142: * @covers \Drupal\Core\Menu\LocalActionManager::getActionsForRoute
tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php:122: * @covers \Drupal\Core\Menu\ContextualLinkDefault::getRouteName
tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php:134: * @covers \Drupal\Core\Menu\ContextualLinkDefault::getGroup
tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php:146: * @covers \Drupal\Core\Menu\ContextualLinkDefault::getOptions
tests/Drupal/Tests/Core/Menu/ContextualLinkDefaultTest.php:158: * @covers \Drupal\Core\Menu\ContextualLinkDefault::getWeight
tests/Drupal/Tests/Core/Annotation/TranslationTest.php:34: * @covers \Drupal\Core\Annotation\Translation::get
tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php:89: * @covers \Drupal\Core\Entity\EntityListBuilder::getOperations
tests/Drupal/Tests/Core/Access/AccessManagerTest.php:501: * @covers \Drupal\Core\Access\AccessManager::checkNamedRoute
In short change @covers \Drupal\Core\Field\BaseFieldDefinition::getColumns
to @covers ::getColumns
Comment | File | Size | Author |
---|---|---|---|
#2 | updated-@covers-documentations-2409587-2.patch | 9.41 KB | Cogax |
Comments
Comment #1
Cogax CreditAttribution: Cogax commentedComment #2
Cogax CreditAttribution: Cogax commentedI've updated some @covers docs.
Comment #3
daffie CreditAttribution: daffie commentedGood work @Cogax!
It all looks good to me.
All the @covers are now in order with one exception. That is in "tests/Drupal/Tests/Core/Routing/RouteMatchTest.php" on line 33: "* @covers \Drupal\Core\Routing\NullRouteMatch" which is pointing to another class. Lets fix that in a followup that also removes some dependencies and adds some mocks to the test class.
It gets a RTBC from me.
Comment #6
daffie CreditAttribution: daffie commentedBack to RTBC.
Comment #7
Mile23Just want to bring folks' attention to this: #2415441: Automate finding @covers errors
Comment #8
alexpottCommitted 22a1fd6 and pushed to 8.0.x. Thanks!