You are here

protected function PHPUnit_Framework_TestSuite::addTestMethod in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/phpunit/phpunit/src/Framework/TestSuite.php \PHPUnit_Framework_TestSuite::addTestMethod()

Parameters

ReflectionClass $class:

ReflectionMethod $method:

1 call to PHPUnit_Framework_TestSuite::addTestMethod()
PHPUnit_Framework_TestSuite::__construct in vendor/phpunit/phpunit/src/Framework/TestSuite.php
Constructs a new TestSuite:

File

vendor/phpunit/phpunit/src/Framework/TestSuite.php, line 839

Class

PHPUnit_Framework_TestSuite
A TestSuite is a composite of Tests. It runs a collection of test cases.

Code

protected function addTestMethod(ReflectionClass $class, ReflectionMethod $method) {
  if (!$this
    ->isTestMethod($method)) {
    return;
  }
  $name = $method
    ->getName();
  if (!$method
    ->isPublic()) {
    $this
      ->addTest(self::warning(sprintf('Test method "%s" in test class "%s" is not public.', $name, $class
      ->getName())));
    return;
  }
  $test = self::createTest($class, $name);
  if ($test instanceof PHPUnit_Framework_TestCase || $test instanceof PHPUnit_Framework_TestSuite_DataProvider) {
    $test
      ->setDependencies(PHPUnit_Util_Test::getDependencies($class
      ->getName(), $name));
  }
  $this
    ->addTest($test, PHPUnit_Util_Test::getGroups($class
    ->getName(), $name));
}