Can @group annotation be used at class level in phpunit

I am trying to explore the possibility of using @group or @author annotations at the class level, so that I can assign some kind of property to certain people. In addition, with this I plan to manage macros, for example: if I want one or several classes to be launched (completely), I can simply specify their groups as, say, ABC, and then use the --groups option.

Currently, I think that @groups or @author is only used at the test case level, not at the test class level. I think one class can have hundreds of test cases, and writing @author or @group would be very tedious. And in the future, if property changes, we need to change the annotation attribute everywhere. Therefore, is there a way to specify @group or something similar at the class level?

+5
source share
1 answer

Yes, you can use @group in test classes. However, I could not find it in the documentation so this could change. (I tested it on PHPUnit v3.7.37)

Note: this is something that is pretty easy to try, I would even say faster than asking for it here. Also typing "phpunit class level group annotation" in google will give you

+7
source

Source: https://habr.com/ru/post/1201871/


All Articles