@@ -489,4 +489,82 @@ final class TestDoxTest extends TestCase {
489489 depth : 2 ,
490490 } ) ) ;
491491 } ) ;
492+
493+ it ( 'parse @group annotation' , ( ) => {
494+ const file = phpUnitProject ( 'tests/GroupTest.php' ) ;
495+ const content = `<?php declare(strict_types=1);
496+
497+ use PHPUnit\\Framework\\TestCase;
498+
499+ final class GroupTest extends TestCase {
500+ /**
501+ * @group integration
502+ * @group slow
503+ */
504+ public function test_with_groups() {
505+ $this->assertTrue(true);
506+ }
507+ }
508+ ` ;
509+ expect ( givenTest ( file , content , 'test_with_groups' ) ) . toEqual ( expect . objectContaining ( {
510+ type : TestType . method ,
511+ file,
512+ id : 'Group::With groups' ,
513+ classFQN : 'GroupTest' ,
514+ className : 'GroupTest' ,
515+ methodName : 'test_with_groups' ,
516+ annotations : { group : [ 'integration' , 'slow' ] } ,
517+ depth : 2 ,
518+ } ) ) ;
519+ } ) ;
520+
521+ it ( 'parse #[Group] attribute' , ( ) => {
522+ const file = phpUnitProject ( 'tests/GroupAttributeTest.php' ) ;
523+ const content = `<?php declare(strict_types=1);
524+
525+ use PHPUnit\\Framework\\TestCase;
526+ use PHPUnit\\Framework\\Attributes\\Group;
527+
528+ final class GroupAttributeTest extends TestCase {
529+ #[Group('plaid')]
530+ #[Group('api')]
531+ public function test_with_group_attributes() {
532+ $this->assertTrue(true);
533+ }
534+ }
535+ ` ;
536+ expect ( givenTest ( file , content , 'test_with_group_attributes' ) ) . toEqual ( expect . objectContaining ( {
537+ type : TestType . method ,
538+ file,
539+ id : 'Group Attribute::With group attributes' ,
540+ classFQN : 'GroupAttributeTest' ,
541+ className : 'GroupAttributeTest' ,
542+ methodName : 'test_with_group_attributes' ,
543+ annotations : { group : [ 'plaid' , 'api' ] } ,
544+ depth : 2 ,
545+ } ) ) ;
546+ } ) ;
547+
548+ it ( 'parse single @group annotation' , ( ) => {
549+ const file = phpUnitProject ( 'tests/SingleGroupTest.php' ) ;
550+ const content = `<?php declare(strict_types=1);
551+
552+ use PHPUnit\\Framework\\TestCase;
553+
554+ final class SingleGroupTest extends TestCase {
555+ /**
556+ * @group unit
557+ */
558+ public function test_unit() {
559+ $this->assertTrue(true);
560+ }
561+ }
562+ ` ;
563+ expect ( givenTest ( file , content , 'test_unit' ) ) . toEqual ( expect . objectContaining ( {
564+ type : TestType . method ,
565+ file,
566+ methodName : 'test_unit' ,
567+ annotations : { group : [ 'unit' ] } ,
568+ } ) ) ;
569+ } ) ;
492570} ) ;
0 commit comments