You are here

public static function PHPUnit_Util_Test::getGroups in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/src/Util/Test.php \PHPUnit_Util_Test::getGroups()

Returns the groups for a test class or method.

@since Method available since Release 3.2.0

Parameters

string $className:

string $methodName:

Return value

array

4 calls to PHPUnit_Util_Test::getGroups()
PHPUnit_Extensions_GroupTestSuite::__construct in vendor/phpunit/phpunit/src/Extensions/GroupTestSuite.php
Constructs a new TestSuite:
PHPUnit_Framework_TestSuite::addTestMethod in vendor/phpunit/phpunit/src/Framework/TestSuite.php
PHPUnit_Framework_TestSuite::createTest in vendor/phpunit/phpunit/src/Framework/TestSuite.php
PHPUnit_Util_Test::getSize in vendor/phpunit/phpunit/src/Util/Test.php
Returns the size of the test.

File

vendor/phpunit/phpunit/src/Util/Test.php, line 606

Class

PHPUnit_Util_Test
Test helpers.

Code

public static function getGroups($className, $methodName = '') {
  $annotations = self::parseTestMethodAnnotations($className, $methodName);
  $groups = array();
  if (isset($annotations['method']['author'])) {
    $groups = $annotations['method']['author'];
  }
  elseif (isset($annotations['class']['author'])) {
    $groups = $annotations['class']['author'];
  }
  if (isset($annotations['class']['group'])) {
    $groups = array_merge($groups, $annotations['class']['group']);
  }
  if (isset($annotations['method']['group'])) {
    $groups = array_merge($groups, $annotations['method']['group']);
  }
  if (isset($annotations['class']['ticket'])) {
    $groups = array_merge($groups, $annotations['class']['ticket']);
  }
  if (isset($annotations['method']['ticket'])) {
    $groups = array_merge($groups, $annotations['method']['ticket']);
  }
  foreach (array(
    'method',
    'class',
  ) as $element) {
    foreach (array(
      'small',
      'medium',
      'large',
    ) as $size) {
      if (isset($annotations[$element][$size])) {
        $groups[] = $size;
        break 2;
      }
      if (isset($annotations[$element][$size])) {
        $groups[] = $size;
        break 2;
      }
    }
  }
  return array_unique($groups);
}