File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 3434use OCP \Lock \LockedException ;
3535use OCP \Security \ISecureRandom ;
3636use OCP \Server ;
37+ use PHPUnit \Framework \Attributes \Group ;
3738
3839if (version_compare (\PHPUnit \Runner \Version::id (), 10 , '>= ' )) {
3940 trait OnNotSuccessfulTestTrait {
@@ -545,11 +546,22 @@ protected function getGroupAnnotations(): array {
545546
546547 $ r = new \ReflectionClass ($ this );
547548 $ doc = $ r ->getDocComment ();
549+
550+ if (class_exists (Group::class)) {
551+ $ attributes = array_map (function (\ReflectionAttribute $ attribute ) {
552+ /** @var Group $group */
553+ $ group = $ attribute ->newInstance ();
554+ return $ group ->name ();
555+ }, $ r ->getAttributes (Group::class));
556+ if (count ($ attributes ) > 0 ) {
557+ return $ attributes ;
558+ }
559+ }
548560 preg_match_all ('#@group\s+(.*?)\n#s ' , $ doc , $ annotations );
549561 return $ annotations [1 ] ?? [];
550562 }
551563
552- protected function IsDatabaseAccessAllowed () {
564+ protected function IsDatabaseAccessAllowed (): bool {
553565 $ annotations = $ this ->getGroupAnnotations ();
554566 if (isset ($ annotations )) {
555567 if (in_array ('DB ' , $ annotations ) || in_array ('SLOWDB ' , $ annotations )) {
You can’t perform that action at this time.
0 commit comments