Score:2

Where can I find the Annotation(s) for test classes?

in flag

I've seen lots of examples of tests like:

/**
 * My test description.
 *
 * @group mymodule
 */
class MyModuleTest extends KernelTestBase { }

I know what @group mymodule is and how that annotation works, but what other information can I put there? or, more importantly, where is that information defined? I can’t find it anywhere.

Score:5
cn flag

Yes, these are annotations. See https://phpunit.readthedocs.io/en/9.5/annotations.html

Specifically in Drupal the @group annotation is mandatory. The @requires annotation is optional. The description is discovered from the lines above the first annotation or, if specified, from @coversDefaultClass.

See TestDiscovery::getTestInfo.

sonfd avatar
in flag
Exactly what I was looking for. Thank you.
Score:3
id flag

@group is one of the many available PHPUnit annotations.

sonfd avatar
in flag
Oh, of course they are just PHPUnit annotations. That makes more sense. Thank you!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.