You are here

public static function PHPUnit_Util_Test::parseTestMethodAnnotations in Zircon Profile 8

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

@since Method available since Release 3.4.0

Parameters

string $className:

string $methodName:

Return value

array

Throws

ReflectionException

9 calls to PHPUnit_Util_Test::parseTestMethodAnnotations()
PHPUnit_Framework_TestCase::getAnnotations in vendor/phpunit/phpunit/src/Framework/TestCase.php
Returns the annotations for this test.
PHPUnit_Util_Test::getBooleanAnnotationSetting in vendor/phpunit/phpunit/src/Util/Test.php
@since Method available since Release 3.4.0
PHPUnit_Util_Test::getDependencies in vendor/phpunit/phpunit/src/Util/Test.php
Returns the dependencies for a test class or method.
PHPUnit_Util_Test::getExpectedException in vendor/phpunit/phpunit/src/Util/Test.php
Returns the expected exception for a test.
PHPUnit_Util_Test::getGroups in vendor/phpunit/phpunit/src/Util/Test.php
Returns the groups for a test class or method.

... See full list

File

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

Class

PHPUnit_Util_Test
Test helpers.

Code

public static function parseTestMethodAnnotations($className, $methodName = '') {
  if (!isset(self::$annotationCache[$className])) {
    $class = new ReflectionClass($className);
    self::$annotationCache[$className] = self::parseAnnotations($class
      ->getDocComment());
  }
  if (!empty($methodName) && !isset(self::$annotationCache[$className . '::' . $methodName])) {
    try {
      $method = new ReflectionMethod($className, $methodName);
      $annotations = self::parseAnnotations($method
        ->getDocComment());
    } catch (ReflectionException $e) {
      $annotations = array();
    }
    self::$annotationCache[$className . '::' . $methodName] = $annotations;
  }
  return array(
    'class' => self::$annotationCache[$className],
    'method' => !empty($methodName) ? self::$annotationCache[$className . '::' . $methodName] : array(),
  );
}